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

Why does this Camera pan eventually slow down and stop?

Asked by
alibix123 175
11 years ago
01local target = workspace.sub --this is a part
02local camera = workspace.CurrentCamera
03camera.CameraSubject = target
04local angle = 0
05 
06 
07while true and wait() do
08 
09        camera.CoordinateFrame = CFrame.new(target.Position)  --Start at the position of the part
10 
11    camera.Focus = camera.Focus * CFrame.new(1,0,0)
12 
13end

It works for a few seconds then slows down and slightly pans downwards, what did I do wrong?

0
What exactly are you trying to do? User#2 0 — 11y
0
I'm trying to pan the camera around in a circle, slowly. alibix123 175 — 11y

1 answer

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
11 years ago

I don't understand matrix math, especially with CFrame, so I prefer to do camera manipulation manually:

01local target = Workspace.sub
02local camera = Workspace.CurrentCamera
03camera.CameraSubject = target
04local angle = 0 --Starting anle, in degrees.
05 
06local foc = Vector3.new(0, -.1, 0) --Only x and z are affected by the rotation math. You can change y freely.
07while wait() do
08    foc = Vector3.new(math.cos(math.rad(angle)), foc.Y, math.sin(math.rad(angle)))
09    camera.CoordinateFrame = CFrame.new(target.Position)
10    camera.Focus = CFrame.new(target.Position + foc)
11    angle = angle + .5
12end
Ad

Answer this question