Sorry to pick up this ages old Thread, but the problem seems to fit:
We have a custom setup, but maybe someone has any idea:
If I change the targetProperty to “scaling.x” or “postion.x” this works flawlessly, using any rotation component will play an Animation in the Inspector, but rotation values will not change in the Inspector, nor will the model animate.
Using scaling and position I see the values change in the Inspector and the animation.
gltf models are using rotationQuaternions and not rotation by default. So you either need to animate the quaternion or you need to setup the mesh.rotationQuaternion to null before playing with the euler rotation.
I’ve spent two days trying to figure out why my rotation animations don’t work. I finally found this thread, which then allowed to find this sentence in the docs
Some software saves all meshes with a rotationQuaternion set and you cannot then use the rotation methods unless you first add
myMesh.rotationQuaternion = null; //Any version of Babylon.js
That is just so random.
Guys… surely we can do better at surfacing user usage errors. May I suggest throwing an error when attempting to use Euler angle rotations while a quaternion vector is set on the mesh/model?
Or… even better, just provide methods on all rotatable objects that can take Euler angles but do them using quaternions under the hood. Meaning, all rotations are always done as quaternion computations, but a user can get and set the rotation values as Euler angles with new API methods.
@arcman7, first and foremost, welcome to the Babylon family! It’s great to have you here.
Secondly, great suggestion. Sorry this was hard one to figure out. I’ve run into similar frustration in the past myself trying to navigate the difference between rotationQuaternion and Euler angles.
One thing we could do is add some more examples in the docs, but it doesn’t sound like you’re suggesting a doc update here, but rather better error handling OR perhaps some new methods that are a bit intelligent under the hood, allowing the developers to not have to worry about mentally managing this difference themselves?
I like this last idea a lot. @sebavan - Not sure how technically possible this would be but it’s definitely worth exploring and talking about.
Let me know if there’s a specific doc update that we think would be helpful in the meantime.
Hi PirateJC, thanks for the warm welcome Overall I do appreciate Babylon JS, I’ve gotta say my tiny project is coming along thanks to this library. There have been a number obstacles I’ve encountered throughout my adoption period however, and I’d be happy to elaborate on what those have been for me personally in another thread (where ever appropriate).
I am suggesting either throwing an error when the operation the user is attempting to do is blocked by the existence of the rotationQuaternion property or a bigger change that accomplishes:
OR perhaps some new methods that are a bit intelligent under the hood, allowing the developers to not have to worry about mentally managing this difference themselves?
I figure since I’m going to be using this library so much I’d be happy to try making a pull request for the smaller change of throwing an error, just to start with, but I’d definitely need someone to pair up with to get my dev environment set up and to show me where to even make those changes.
Awesome! We are always THRILLED to have people contribute to Babylon!
Here’s a good doc to review to get started contributing:
If you get stuck along the way, feel free to use the forum for help. You’ll hopefully discover that this is a VERY friendly and helpful community of people.
Hi @carolhmj I’ll have to try setting up the environment again sometime in the near future. If I have any problems I will let you know. Thanks for asking!