Camera and character movement for isometric camera script

I’ve been trying this isometric camera tutorial implementing the code provided with some slight changes:

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 = 25

camera.FieldOfView = 40

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)

And looks like this: https://gyazo.com/…

The code mentioned above fixes the camera with CFrame.lookAt “disabling” the rotation along the Y axis. Is there any possible way to add this functionality again?

Additionally, how can I make the character to always look “north” relative to the camera view? I need this in order to make the camera always point to the back of the character. My intention is that the character auto-rotates when the camera turns (using the RMB, swipe in mobile or camera thumbstick with controller) and that the direction of the movement is relative to camera view, not to world (with keyboard: WASD should be NorthEastSouthWest according to camera view).

1 Like