Move camera in a circle

I want the camera to quickly move in a circle with the player centered. Ive tried some the script below but it was too slow and off center

for i=1,360 do
    task.wait()
    char.Humanoid.CameraOffset = (CFrame.new(char.Humanoid.CameraOffset) * CFrame.Angles(0,0,math.rad(i)) * CFrame.new(0,0.1,0)).p
end

Result : (Too slow and off center)
Image from Gyazo

How would I achieve a faster and centered spin?

for i = 0, 360, 2 do

You could start by increasing the increment of the control variable of the numeric for loop for each cycle.

how do i fix the centered issue?

If you’re trying to make it spin around the character you could use half of the offset beginning at the players position

not sure how exactly do you want it to look. try this maybe

local TweenService = game:GetService('TweenService')

local char = game:GetService('Players').LocalPlayer.Character


local function GetPointOnCircle(circleRadius: number, degrees: number): Vector3
	local radians = math.rad(degrees)
	local xPos = math.cos(radians) * circleRadius
	local yPos = math.sin(radians) * circleRadius

	return Vector3.new(xPos, yPos, 0)
end


-- config
local totalTicks = 70  -- higher = smoother/slower and vice-versa
local radius = 5
--

local step = 360 / totalTicks
local angleOffset = -90

for i = 1, totalTicks do
	local angle = step * i + angleOffset
	local point = GetPointOnCircle(radius, angle)
	char.Humanoid.CameraOffset = point + Vector3.new(0, radius, 0)
	task.wait()
end

char.Humanoid.CameraOffset = Vector3.new()
2 Likes