Getting NaN on iOS when using animation.
I use an Animator on a GameObject hierarchy with a clip animating the rotation of a child. Everything is fine in the editor (5.3.0.f4). On iOS the animation generates NaN for rotation and scale of that child object so that the attached sprite is not being rendered.
I reduced everything in order to find the bug.
The hierarchy is: Root->Body->Head->Jaw
Animator is attached to Root.
The animation clip does only a rotation around the z-axis starting at 20 and going to 10. So nothing special here.
An attached script logs for the Head object:
Local Rotation: (NaN, NaN, NaN, NaN)
Rotation: (NaN, NaN, NaN, NaN)
Local Scale: (1.0, 1.0, 1.0)
Scale: (NaN, NaN, NaN)
Only position seems to be fine.
If I don't change any value within the animation (only static values) everything stays fine.
Anyone an idea what I'm doing wrong? Thanks!
Answer by DLBit · Dec 20, 2015 at 11:57 AM
Seems to work if I switch Interpolation from Euler Angles to Quaternion in the animation clip. Is it a bug in the iOS implementation or did I miss something?
Took me a while to figure out how to change the interpolation settings. You have to right-click on the animation properties. This fixed my issue also, for the record, so thanks!
Answer by DLBit · Dec 21, 2015 at 09:38 AM
Problem still exists in 5.3.1f1.
@DLBit, just wanted to say that I'm having the same "problem" ? (I'm new to Unity so I'm not really sure if this is not because of something I'm doing wrong).
I had an older project from a tutorial I followed which had some rotations on sprites which worked as expected. So I checked the interpolation types and the value was set to "Euler Angle (Quaternion Approximation)". In the tutorial it wasn't a step to manually choose this interpolation type so I'm guessing it's the default value that has changed with Unity3D updates.
I set the interpolation to "Euler Angle (Quaternion Approximation)" and now I have the animation working properly on iOS.
Thanks. Glad to see I'm not alone with it. You're right. On iOS, Euler Angle (Quaternion Approximation) works too. Just tried it. So everything works fine except for the default... $$anonymous$$aybe I should report it as a bug.
I am also having the same issue on Android devices This is a really use full information
Changing to Quaternion Approximation worked for me too ...
I also just dealt with this issue. Right now it seems that your solution of changing the Interpolation $$anonymous$$ode to Quaternion is the only way to change it.
Also had this issue and your workaround did the trick. Thanks!
Your answer
Follow this Question
Related Questions
Unintended behavior with setting the position of an animated character in a timeline. 0 Answers
Cinemachine/Timeline not playing animation on Maximize on Play 1 Answer
When exporting from Blender, animation gets messed up 0 Answers
Why wont the target be destroyed? 0 Answers
Importing Unity Store Asset from project into blender. 0 Answers