How to make a top-down camera view?

I have found some topics regarding top-down camera view but they all seem to be unanswered and the youtube videos seem to have outdated code.

Could someone help me out with this?

2 Likes

If i understand you right you want to create something like this?

2 Likes

Yes that is what I am wanting.
I should’ve provided a video example in my original post but ah well.

2 Likes

Alright! its pretty simple.

  1. Set “CameraType” property to Scriptable. This will lock the camera completley letting you freely code its behavior yourself.

  2. Bind a function to “RenderStepepd” to update each frame. Inside this function position the Cameras CFrame onto the players HumanoidRootPart(Or whatever part you specified) position plus add the HumanoidRootPart’s UpVector and multiply it by the variable called “StudsY” and rotate it by -90.

This will position the Camera 20 studs above the HumanoidRootPart and point down.

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

local Cam = workspace.CurrentCamera



local StudsY = 20 -- Customize however you want.


local function Enable()
	Cam.CameraType = Enum.CameraType.Scriptable

	game["Run Service"].RenderStepped:Connect(function()
		Cam.CFrame = CFrame.new(Primary.Position + Primary.CFrame.UpVector*StudsY) * CFrame.Angles(math.rad(-90),0,0)
	end)
end



Enable()

But if you dont want the camera to also move up when the player jumps like you can see in the video use this code instead.

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

local Cam = workspace.CurrentCamera



local StudsY = 20


local function Enable()
	Cam.CameraType = Enum.CameraType.Scriptable

	game["Run Service"].RenderStepped:Connect(function()
		Cam.CFrame = CFrame.new(Primary.Position.X,StudsY,Primary.Position.Z) * CFrame.Angles(math.rad(-90),0,0)
	end)
end



Enable()
8 Likes

Thanks for the help. One more question though, does CFrame.Angles determine the orientation of the camera in radians?

3 Likes

Yeah sorry my bad :sweat_smile: its determined in radians

2 Likes

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