Why can't a Timeline key frame contain zero Position values?
I don't really understand what is going on here. Let me describe it and then maybe someone can tell me what is happening.
If I create an Empty with a Playable Director and add three sub-objects such that they form a "formation" (one slightly forward and to the left, one at the origin of the Empty, and one slightly behind and to the right), and then I create a Timeline key frame, then move the animation playhead to, say, +5 seconds, move all three sub-objects together (not the Empty) and then create a new keyframe, the child that was at the origin of the Empty jumps to the final key frame position for the entire animation, yet the other children animate from the original position as I'd expect. Looking at the curves I can see that the object that was at the origin did not get coordinates "recorded" in the key frame, so it ends up "back-projecting" the final key frame coordinates to the start of the animation.
But if I have the child object slightly not at the origin of the Empty (e.g. 0.001 for X, Y and Z Position) then the animation works as expected for all three children.
So something unusual is happening when a child of an object with the Playable Director on it is exactly at zero origin. It's as if the key frame cannot contain zeros - but why?
It looks like the "Add Key" operation didn't add a position key for T0 for the object that was at (0,0,0), so when it moved to the new position at time T1 it back-applied the new position to T0. The fix was to manually add a position 0,0,0 keyframe to this object so that it behaves like the other two.
I have no idea why a position keyframe wasn't added - it was for the other two objects. Some logic bug perhaps that thinks it hadn't moved from some initialised state.
Answer by seant_unity · Oct 26, 2020 at 11:42 AM
How are you adding the 0 key frame? The key frame is usually recorded when a value changes. So if you type in '0', it doesn't generate a key frame if it's already 0. Instead, right click a property in the inspector add select 'AddKey' in the context menu, which will add a key with the existing value.
Answer by pitchblende · Oct 26, 2020 at 08:44 PM
@seant_unity I have the three objects each with their own animation track. I have them at their initial position (relative to the parent Empty), note that one of them is (0,0,0) relative to the Empty. When I start recording for all three animation tracks, select all three objects, and then right-click the Position in Transform and select "Add Key" it only creates a Position key for the two objects that are not at (0,0,0). The object that is at (0,0,0) does not get a Position key frame and if I open this animation track in the Animation view I can see that it doesn't have one. This is 100% reproducible for me - every time.
Now if I move the (0,0,0) object to anything else, even slightly, and repeat, then this object gets a key frame.
I have tried to reproduce this, and haven't had any luck - all 3 tracks have added the key, so I'm missing something, or the version I'm trying with already has a fix. Which version of Unity & Timeline are you using? However, it appears you have stumbled across a bug. I'd recommend filing a bug (Help->Report a bug...) that way our QA team can do their magic to help us address the issue.
Ok, I'll revisit my situation and try with the latest version. I don't recall exactly which version but it's 2020.1.something but a little old. Thanks for the advice.
Your answer
Follow this Question
Related Questions
When walking animation loops in timeline, it resets the player´s position back to the start 0 Answers
How does one copy and paste keyframes in the Animation Editor? 4 Answers
Does changing multiple sprites on a single animation affect performance? 0 Answers
Animations unwanted movement and rotation after updating 0 Answers
Infinite Time inbetween if statements? 2 Answers