- Home /
FIXED - Editing animation clips gives NaN on rotation value
Hi all,
I have a waving animation which I'm trying to edit. So I duplicate the clip (.anim file) so I have a non read-only clip I can edit in Unity.
I edit some keyframes on the arms to make them stick out more so they avoid clipping through the waist - however I notice a flicker right at the end of the loop. On investigating the frame further, I noticed that the Y rotation for the arms was returning NaN, making the arms dissappear on that frame.
I tried deleting the last keyframe (the one which was returning NaN) and the problem ocurred on the "next" keyframe -ie what was the second to last (and now last) keyframe. It always occurs on the last keyframe on the anim clip.
I only moved the frames a little bit - there are no crazy jags or spikes in the anim curve. I can't think whats causing this and would really appreciate any advice - it would really help my workflow to be able to edit anim clips in Unity.
Did some further experimentation and it appears moving ANY keyframe creates the NaN error on the selected bone (ie moving a keyframe on the arm means the last keyframe on the arm returns the NaN value for Y rotation, makes the arm disappear, and makes Unity crash if triggered at runtime). Any help or anyone experiencing the same problem, I'd still be most grateful.
Update - console gives the following error message when running through the clip in Editor - Quaternion To $$anonymous$$atrix conversion failed because input Quaternion is invalid {-1.#QNAN0, -1.#QNAN0, -1.#QNAN0, -1.#QNAN0} l=-1.#QNAN0v
Still need help if anyones out there?
Update; it appears that before editing keyframes, you can convert interpolation from Quaternion to Euler on the curves you need to edit. End keyframe then no longer seems to return NaN.
However this still isnt the ideal solution as converting the Quaternion curves to Euler produces very different looking animations which are full of spikes, so heavy editing would be needed anyway. Still looking for a solution to this. Have raised a bug ticket with Unity but no response so far.
Answer by mrlemonyfresh · Aug 10, 2017 at 01:21 AM
Nope. It still happens in the latest version of Unity.
(currently looking for a fix.) This happened when I tried to parent an animated object in a program before bringing it to Unity. It worked fine un-parented. As soon as I parented it, it would no longer accept the animation.
Moral of the story; ???