Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Do I Revert back to Default After Implementing an Isometric Camera?

Asked by
ruwuhi 23
3 years ago

I'm using an isometric camera for my game, as shown below:

local player = Players.LocalPlayer
local camera = workspace.CurrentCamera

local CAMERA_DEPTH = 64
local HEIGHT_OFFSET = 0
camera.FieldOfView = 28

local function updateCamera()
    local character = player.Character
    if character then
        local root = character:FindFirstChild("HumanoidRootPart")
        if root then
            local rootPosition = root.Position + Vector3.new(0, HEIGHT_OFFSET, 0)
            local cameraPosition = rootPosition + Vector3.new(0, 64, CAMERA_DEPTH)
            camera.CFrame = CFrame.lookAt(cameraPosition, rootPosition)
        end
    end
end

RunService:BindToRenderStep("IsometricCamera", Enum.RenderPriority.Camera.Value + 1, updateCamera)

However, I wish to temporarily change to a regular still camera shot. This code did not work in reverting the isometric camera:

local function resetCameraSubject()
    camera.CFrame = workspace.Part.CFrame
end

Does anybody know how I can achieve this?

Answer this question