I have a sphere physics impostor and a regular cube mesh as a child.
The sphere rotates on the z axis.
How do i reset the child mesh z rotation to zero?
I have a sphere physics impostor and a regular cube mesh as a child.
The sphere rotates on the z axis.
How do i reset the child mesh z rotation to zero?
Wanna share a playground so we can help with code?
Will help us a lot to understand exactly what you are trying to achieve.
https://playground.babylonjs.com/#JK7Z9Q#5
I want to reset the cube z rotation to zero in the render loop.
The cube should not rotate, only the sphere.
You can try to apply the sphere inverse transformation to the cube:
https://playground.babylonjs.com/#JK7Z9Q#7
scene.onBeforeRenderObservable.add(() => {
cube.rotationQuaternion = BABYLON.Quaternion.Inverse(sphere.rotationQuaternion);
});
[EDIT]Added a texture to the sphere, else we don’t see it is rotating[/EDIT]
Thank you!
It works as i wanted