Rotation Quaternion undefined While Rotation

I need to rotate a mesh with animation. For that, I am rotating the rotation.y . It is not working as default. When I set the rotationQuaternion to undefined, then it is working properly. But when I set the rotationQuaternion to undefined. It’s natural rotation gets change. How to handle this. Any solution for this.

Does this “Warning” section helps you?

1 Like

Yes @nogalo . This is the same I am facing. So, do you know to make null the quaternion in model while designing the model in maya or blender ?

I don’t think you can do that.

Are you importing mesh with animations, or you control the animation within the code?

I am controlling the animation within code

Can’t you just set that manually then?

When you load meshes for example, set their quaternionRotation to null.

mesh.rotationQuaternion = null

I think you will need to convert the quaternion to euler angles, then set the rotationQuaternion to null and finally set the rotation property with the euler angles:

In this PG, the plane is given some rotations around x/y/z at start through rotationQuaternion. Then after 2s this property is set to null, so the rotation is reset to the default orientation (0,0,0). Then after 2s the rotation property is set with the euler angles corresponding to the first quaternion: you will see that the orientation of the plane is set back to what it was when the quaternion was in effect.

1 Like

If I rotatequternion with animation, then what is the type of the property needs to given, for example, for float value change, we give BABYLON.Animation.ANIMATIONTYPE_FLOAT , for vectors, we give BABYLON.Animation.ANIMATIONTYPE_VECTOR3 . similar to that, what is the constant needs to given for this eular angles?

Euler angles are simply a vector3 of floats. See my PG, it’s the values you assign to the rotation property of the mesh.

1 Like