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

How do I play Moon Animator camera animation?

Asked by 4 years ago

Hey there! I created a camera animation with Moon Animator and was wondering how I could execute it (show it) when someone joined the game.

And yes I am a noob. I have zero coding experience.

2 answers

Log in to vote
0
Answered by 4 years ago

when you export the animation to studio it should come out as a little blue square, save that to roblox as an animation and then get the animations id. watch a youtube tutorial how to play the animation

Ad
Log in to vote
0
Answered by 3 years ago

I was having the exact same issue and been searching everywhere to figure out what to do. After a while I just said screw it and figure it out on my own.

Basically, there's a folder for your camera movement when you export it from moon studio. This folder contains CFrameValues. CFrameValues can't actually be edited and can only be accessed through the script. Basically, the names of the CFramevalue are related to the frame its own. What this means is that for you to see the full animation, you need to play each frame of the camera position within a certain amount of time tuned to the framerate you want.

I have created a script that get the frames from Moon Sutdio export folder and applies the positions to a camera based on a recorded frame.

-- Something to note is that wait() minimum waiting time is 0.0333 meaning if you recorded the camera originally in 60 frames per second and try to wait for 1 out of 60 frames per second(0.016) it will automatically go to 0.03

-- Basically the highest rate you can go is 30 frames per second unless you use something like RunService.Heartbeat:Wait() that waits based on the current system's framerate but I wouldn't recommend it if you have animations you want sync to the camera movement

--The speed of each camera frame moves
-- Its set to 60 frames per second
local fps = 1/60
-- This grabs the camera folder that contain the frames and get all children
local fold = game:GetService("ServerStorage"):WaitForChild("MoonAnimatorExport"):WaitForChild("Camera Testing_Camera"):WaitForChild("Frames"):GetChildren()
-- This is how many frames are in this camera movement
local frames = #fold
--Replace this with the camera you want to move
local cam

-- This will run for each frame
for i=1,frames do
    --This grabs the CFrame value from the folder base on what frame we're on
    local cf = fold[i]
    -- Check if the object exists
    if cf then
        --Set the CFrame to the current frame CFrame
        cam.CFrame = cf.Value
        --Wait the fraction of the frames per second(this is the seconds you wait for one 1 out of 60 which is 0.016)
        wait(fps)
    end
end

Answer this question