Baking Camera Animation In Timeline

Hey Unity Community,

I could really use some guidance as this has kinda stunted my progress.

I will try to explain as simple as possible:

I have a camera in my unity scene 2019.1.9f1, the camera is animated using the timeline, but there is also a script that runs on play mode that adds some additional camera shake motion..

My goal would be to parent a game object, new camera, or whatever to the camera that is animated and essentially bake the transform data so that every 'frame' in my case 30 fps or 60 fps would have a key frame

I have a few reasons for this:

1) Removes the script that is needed to add camera shake
2) Export the camera into After Effects

I need the transform data to be baked to every frame because I want to eliminate any animation interpolation going from unity to after effects.

I really appreciate the help!

-Devin

Also, My method for getting the camera into After effects is

Unity (Export FBX) > Maya (Export .ma) > After Effects (Import)

This only works correctly if I can get the animation data baked down.

Have you looked at the Unity Recorder? It can capture the motion of an object to an animation clip. If that doesn't work there is also a game object recorder API.

Hey @seant_unity ! Thanks for the fast response

I have been trying to use the unity recorder. In theory it sounds like exactly what I want to do, but I’m not having much luck getting baked keyframe data from a moving object in play mode.

I am gonna comb through the documentation once more and verify my steps. If I am still having no luck, I’ll create a quick video to showcase

Alright I have taken a deep dive into this and still have problems, I have been following this documentation

A few things to note about the scene:

1) I have a game object that is acting as a group and I have an animation clip attached to drive the transforms of position and rotation.

2) Inside the game object, I have placed my camera where I have added a script on the camera to add additional positional changes to simulate hand held camera shake

3) I have parented an empty game object under the camera which in theory should give me the exact position for the camera + root game object in step 1.

Following the documentation, does give me an animation file, but when I create a new game object and attach that animation clip to the game object, No animation is present and it doesn't follow the camera from steps 1-2.

When I look at the animation clip that was baked out, it looks l like it gathered a key frame at the beginning and end, but the values are exactly the same under positional values.

Essentially what I need is every frame to have 'world space' transform key frame data and that isn't happening.

Newly developing idea,

I removed step 3 from the game object's hierarchy and added a parent constraint. Set the source to be the camera and tried to record the game object.

IT WORKED, BUT there are some strange things that I can't seem to understand

I set the recorder parameters to capture constant frame rate of 30

But in the animator its only showing a key frame every 40 frames???

5350851--540465--02.png

I imported into Maya to check, and Maya shows a keyframe every frame.

5350851--540468--01.png

@seant_unity I created a video to explain visually, Hope that helps!

https://www.youtube.com/watch?v=0wFnAhg06Sc

I helped out on the Unity Discord and quickly wrote a solution with the recorder api that seems to have solved the issue.

But that video's a really good description of a problem that might exist with the recorder.
Not sure if it's the compressor being aggressive, or if it's some incompatibility with the systems in play. It looks like a bug worth looking into.

1 Like

Here is the bug tracker, if you want to vote for it https://issuetracker.unity3d.com/issues/gameobjects-position-does-not-match-when-the-same-gameobject-animation-is-recorded-using-timeline-and-recorder

wow..... they say its been fixed but I have heard no contact from them... and just tried on the latest version. still broken.

7688830--961930--upload_2021-11-26_17-0-28.png
This solves the every frame bake problem.

7688830--961924--upload_2021-11-26_16-58-27.png

Sigh. I got my hopes up for a moment. I want the same option, but I want it when generating movie files (not animation clips).

7689631--962065--upload_2021-11-26_9-53-55.png