So I’ve been playing around with this script that was previously posted in the Wiki:
local target = workspace.CameraTarget
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
local angle = 0
while true do
wait()
camera.CoordinateFrame = CFrame.new(target.Position) --Start at the position of the part
* CFrame.Angles(0, angle, 0) --Rotate by the angle
* CFrame.new(0, 0, 100) --Move the camera backwards 5 units
angle = angle + math.rad(.2)
end
It’s basically a camera manipulation script where it grabs the CurrentCamera and makes the camera spin around a target it’s focusing on.
A few seconds of this script running, it immediately stops at a certain angle. To my understanding, this may be due to a maximum number angles is only able to calculate, so I’m thinking that maybe when it reaches its 360 angle, it has to be reset to 0? I’m not entirely sure.
I was looking up the API source for math.rad
, but I’m having a difficult time wrapping my head around it. What does radians exactly mean? How can I make the angle reset when it hits 360? For example
if angle == 360 then
angle = 0
end
How would I translate this into radians? (Or any other way if possible.) Sorry if this question might seem basic.