How to make camera rotate around model?

I’m trying to make the player’s camera rotate around a model/car for a loading screen. How would I do this? I’m struggling to figure it out

1 Like

I did some testing, and you could do something like this in a LocalScript:

local RunService = game:GetService("RunService")

local partToRotateAround = workspace:WaitForChild("partToRotateAround")

local speed = 1 -- radians per second
local distanceXZ = 10
local distanceY = 3

local currentAngle = 0

RunService:BindToRenderStep("RotateCamera", Enum.RenderPriority.Camera.Value + 1, function(deltaTime: number)
	currentAngle += speed * deltaTime

	-- Calculate the position offset
	local offset = CFrame.Angles(0, currentAngle, 0) * CFrame.new(0, 0, -distanceXZ)

	-- Set the camera position relative to the part and make it look at the part
	workspace.CurrentCamera.CFrame = partToRotateAround.CFrame * offset * CFrame.new(0, distanceY, 0)
	workspace.CurrentCamera.CFrame = CFrame.lookAt(workspace.CurrentCamera.CFrame.Position, partToRotateAround.Position)
end)
1 Like

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