Issue with top down camera

I’m trying to make a top down game similar to the older MGS games, and i made this code after learning how to manipulate the camera.
My issue is that the rotation moves along with my character. How do i fix this?
Code:

local Plr = game.Players.LocalPlayer
local Char = Plr.Character or Plr.CharacterAdded:Wait()
local Primary = Char:WaitForChild("HumanoidRootPart")

local Cam = workspace.CurrentCamera
Cam.CameraType = Enum.CameraType.Scriptable

while true do 
	task.wait()
	Cam.CFrame = Primary.CFrame * CFrame.new(0,25,0) * CFrame.fromEulerAnglesXYZ(math.rad(-90),0,0)
end

I need the rotation to stay looking down, and have it stay fixed like that.

Dont Use Primary.CFrame and actually make it use the Position of the player. The CFrame is the players position and players rotation if im correct. Im pretty sure all that needs to be done is
Cam.CFrame = Player.Position * CFrame.fromEulerAnglesXYZ(math.rad(-90),0,0)

I dont think that would work due to the fact that the player itself is an actual object with a position and thats why i used the position of the root part, since it has an actual position

Have you tried what they suggested yet?

1 Like

another solution is like this:
camera.CFrame = CFrame.new(plr.Character.PrimaryPart.Position + Vector3.new(0,5,0) + Vector3.new(10,0,0))
camera.FieldOfView = 120
camera.CFrame = CFrame.lookAt(camera.CFrame.Position, plr.Character.PrimaryPart.Position)

Thanks! This worked, although i’m confused on how because the primary part of all players is the humanoid root part

Yes. Its basically putting the cameras position to the hrp and then adding its height and distance from it then looking at it…

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.