Problem with rotating camera

I’m trying to make a birds-eye view camera system and it’s working fine except that the camera is facing the wrong way.

The labels show which side is supposed to be the front, back, left, right of the game and I want the camera to be turned 90° counter clockwise but I’m not sure how to do that.

Here is the script:

local camera = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer

camera.CameraType = Enum.CameraType.Scriptable

local targetDistance = 30
local cameraDistance = -30
local cameraDirection = Vector3.new(0, -1, 0)

local currentTarget = cameraDirection * targetDistance
local currentPosition = cameraDirection * cameraDistance

game:GetService("RunService").RenderStepped:connect(function()
    local character = player.Character
    if character and character:FindFirstChild("Humanoid") and character:FindFirstChild("HumanoidRootPart") then
        local torso = character.HumanoidRootPart
        camera.Focus = torso.CFrame

        if torso:FindFirstChild("FastStart") == nil then
            camera.CoordinateFrame = CFrame.new(torso.Position + Vector3.new(0, 3, 0) + currentPosition,
                torso.Position + Vector3.new(0, 3, 0) + currentTarget)
        else
            camera.CoordinateFrame = CFrame.new(torso.Position + Vector3.new(0, -20, 0) + currentPosition,
                torso.Position + Vector3.new(0, -20, 0) + currentTarget)
        end
    end
end)

How would I rotate the camera?

1 Like

It seems like you just need to add an offset to the camera’s orientation, the Y axis. Try add this to the end of the cframes.

  • math.angles(0,math.rad(90),0)

90 can be changed to whatever

I tried this but I think I did it wrong and so it didn’t work. Found a new way to do it though.

camera.CoordinateFrame = camera.CoordinateFrame * CFrame.Angles(0, 0, math.rad(90))

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