Recently I started making tons of multiplayer games and got interested by some Top-Down Camera shooters. As I was trying to recreate it, I wanted it to be like the roblox Orbital camera control. Here’s the code provided:
local Player = game.Players.LocalPlayer
local Camera = game.Workspace.CurrentCamera
local RunService = game:GetService("RunService")
local StarterPlayer = game:GetService("StarterPlayer")
local Character = Player.Character or Player.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Humanoid = Character:WaitForChild("Humanoid")
RunService.RenderStepped:Connect(function(Step)
Camera.CameraType = Enum.CameraType.Custom
local LookVector = Camera.CFrame.LookVector
HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.Position) * CFrame.Angles(0,math.atan2(-LookVector.X,-LookVector.Z) ,0)
Camera.CFrame = Camera.CFrame:Lerp(CFrame.new(HumanoidRootPart.Position) * CFrame.Angles( 0, math.atan2(-LookVector.X,-LookVector.Z), 0), 0.1 )
end)
Now, this kind of does what I want, however, instead of going from top to bottom, it looks like a Third Person Shooter Camera with the Y Axis disabled.
Odd, because it works perfectly fine, I can rotate the camera on the X and Z Axis perfectly fine. The only problem is that I want the camera to face from top to bottom.