i try to animate the rotation of a mesh. i just try (for testing in console) to rotate with .rotate.y but didn’t work same with rotation.y the only rotation working is .rotationQuaternion.y but it’s scaling up too, i’don’t know really why.
However, i make a function with the animation animateLeftCar and it didn’t work
(it’s seems pretty hard to animate a simple rotation in babylon :s )
The playground Babylon.js Playground
Unfortunately, for me, your playground is too complex to work through. Would you please simplify to just show the rotation issue. For example just load the car and try to rotate it.
It could be that the imported model has its rotationQuaternion already set which used to cause problems but I thought had been dealt with in BJS v4.0.0 onwards - perhaps you are using an earlier version? See warning
setting .rotationQuaternion.y is not changing the rotation about the y axis, quaternions are more complex.
A quaternion has the form a + x i + y j +z k and not all quaternions are rotation quaternions.
A rotation quaternion has to be a unit quaternion, so changing just the y component will produce a none unit vector and the resulting quaternion will produce scaling.
In this PG the top box has random unit quaternions applied and so just rotates, the lower box is just random quaternion not all are unit ones and so produce scaling as well
I load the car and rotate with : carModel.rotate(BABYLON.Axis.Y, 2 * Math.PI/2, BABYLON.Space.LOCAL);
It’s working, but how to animate the rotation ?
I want a custom animation of the car when i go left or right (like a small rotation of the car without the wheels)