I recently just finished animating something but I’ve never used a camera before I have no clue how to script it.
whenever i export it, it does not export as a keyframe sequence just this
I know its not hard but I’m just very new to this.
I recently just finished animating something but I’ve never used a camera before I have no clue how to script it.
whenever i export it, it does not export as a keyframe sequence just this
I know its not hard but I’m just very new to this.
If you haven’t, you should be using a reference part with moon animator, since it allows the camera values to be used even if the position of the cutscene varies in-game.
Anyways, when you want to begin the cutscene, set the camera’s mode to Scriptable so it can be edited and then create a RenderStepped loop. To find where the camera should be, you just need to take the elasped time and multiply it by 60, then find it amongst the stored frame values.
However, because the elasped time times 60 is almost never a whole number, you’ll want to find the lowest closest number and the highest closest number with math.floor() and math.ceil(). Then you want to lerp the lower value to the higher value based on the time passed to the next frame. In short, this:
LF_Time = math.floor(ElaspedTime * 60)
NF_Time = math.ceil(ElaspedTime * 60)
LastFrame = Frames[tostring(LF_Time)]
NextFrame = Frames[tostring(NF_Time)]
--Make sure to catch if one of those returns nil
Camera.CFrame = LastFrame:Lerp(NextFrame,(ElaspedTime * 60) - LastFrame)
Also, this is kind of an ineffecient way to use the camera values here, since they take up around hundreds of instances. It’s preferable to use a only the values corresponding to the keyframes in moon animator, and then using tweens instead.