Flomotion Posted August 16, 2018 Share Posted August 16, 2018 I want to animate the rotation of some objects from an imported mesh. But the rotation behaves very different on an imported object. How can I get this to work the same as it works on native objects. To illustrate I made a playground where the cube above the cat behaves as it should. They both have the same keyframes.: http://www.babylonjs-playground.com/#EEUVTY#4 I hope someone knows, thanks! Floris Quote Link to comment Share on other sites More sharing options...
brianzinn Posted August 16, 2018 Share Posted August 16, 2018 I am not sure about the root cause, but if you animate a parent then it works, so maybe that helps? http://www.babylonjs-playground.com/#EEUVTY#5 ** edit: yours works if you set: cat.rotationQuaternion = null; Use one or the other - that's a gotcha that gets everybody! Use animation type: BABYLON.Animation.ANIMATIONTYPE_QUATERNION otherwise - if you need an example ask. Flomotion 1 Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 16, 2018 Share Posted August 16, 2018 The object is using quaternion so you would need to animate rotationQuaternion and not the rotation: http://www.babylonjs-playground.com/#EEUVTY#6 I invalidate the rotationQuaternion on cat by forcing it to null. I agree it is not intuitive I ll try to find a good spot in the doc for it. Quote Link to comment Share on other sites More sharing options...
Flomotion Posted August 16, 2018 Author Share Posted August 16, 2018 Thank you both so much! cat.rotationQuaternion = null; Easy and perfect solution! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.