Problem using animation after a rotation

Hi all,

I have a problem with an animation that is working well as long as I don’t try to rotate the mesh prior to it.

https://playground.babylonjs.com/#ZTB20L

I commented the
polygon.rotate(BABYLON.Axis.X, -Math.PI / 2, BABYLON.Space.LOCAL);
so everything is ok, but if I rotate the polygon then the animation won’t trigger.

What am I doing wrong ?

Thanks

Hey, you are using a method rotate() to change the rotation value. This function sets the rotationQuaternion property. When this property is used to control rotation, the rotation property is then ignored. Problem is you are now animating a property that is no-longer doing anything. Just set the rotation starting value directly, instead of using that function, https://playground.babylonjs.com/#ZTB20L#1

1 Like

Thanks JC, I was still working on the problem and realized that just after reading the rotate method description in playground. I used :
polygon.rotation = new BABYLON.Vector3(Math.PI / 2,0,0);
and everything was ok.

Thanks for being so quick.

1 Like