PcoWSkbVqDnWTu_dm2ix
Controlling the Player's Camera
Part 3 - Creating an Isometric Camera
Controlling the Player's Camera
Part 3 - Creating an Isometric Camera

The basic structure of getting the player’s position and updating the camera’s position every frame can be adapted to many other camera styles. An Isometric camera is a 3D view pointing slightly down at a fixed angle towards the player.

alt

Modifying Position and View

  1. Using the code from the previous example, modify cameraPosition to add the same amount to all 3 dimensions.

    alt

    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(CAMERA_DEPTH, CAMERA_DEPTH, CAMERA_DEPTH)
                camera.CFrame = CFrame.lookAt(cameraPosition, rootPosition)
            end
        end
    end
    
    RunService:BindToRenderStep("IsometricCamera", Enum.RenderPriority.Camera.Value + 1, updateCamera)
  2. Changing the camera’s Camera/FieldOfView|FieldOfView property will simulate zooming it in and out, which can give the view a flatter look. Try setting it to a value of 20 to zoom in, and increasing the camera’s distance from the player to compensate.

    local Players = game:GetService("Players")
    local RunService = game:GetService("RunService")
    
    local player = Players.LocalPlayer
    local camera = workspace.CurrentCamera
    
    local CAMERA_DEPTH = 64
    local HEIGHT_OFFSET = 2
    
    camera.FieldOfView = 20
    
    local function updateCamera()

By changing the way the camera behaves, you can achieve a whole new look for your game. See if you can change the cameraPosition to achieve a top-down camera with the same script. Try tweaking settings to get a result you like!


Previous Page Creating a Side-Scrolling Camera