Problem with top-down camera

Currently, the players HumanoidRootPart is scripted to face the mouse.
Heres what im using to get the camera CFrame:

CFrame.new(plr.Character.HumanoidRootPart.Position) --[[ position to the player ]] * CFrame.new(0,30,5) --[[ apply an offset]] * CFrame.new(plr.Character.HumanoidRootPart.CFrame.LookVector * 15)--[[ apply offset based on character rotation]] * CFrame.Angles(math.rad(-80),0,0) -- add rotation effect

This has an undesired result however, as it seems to be going off the center of the screen rather then the player, causing the player to flip whenever the players mouse gets near, as shown:

this is not amogus

I would just do

CFrame.new((plr.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -15) + Vector3.new(0, 30, 0)).Position) * CFrame.Angles(math.rad(-80), 0, 0)

The Z value of this is probably not oriented in your desired direction, this may be causing it.

Also, it might just be how your system works, the lookvector offset might be the root of it.

Tested your code, and it has a similar problem.

The Z value is to position the camera slightly down, since its angled at -80 degrees, so its pointing at the player.

I’m open for recommendations on a new and better way to do this, but at the moment I have no clue.

Is your top down camera supposed to rotate as the player rotates? or keep a constant orientation, while looking down?

Supposed to keep a constant orientation while looking down, yes.

I think I see what you are trying to do, why not try to use the CFrame.LookAt constructor, and see if by setting the ‘up’ property, that can keep it steady at a steeper angle

The angle isn’t really the problem, its more of that it prefers to move around the center of the screen then rather the player.

Thanks for the help, I really do appreciate it.

I’m just gonna live mutually with the bug, but i did reduce the range at which the camera goes out from the player, which helped a lot. Cheers!

1 Like