Changing the mesh rotation in onBeforeRenderObservable resets position for physics objects

Not sure what other info to give, I made this playground to demonstrate. Really bizarre, took my ages to find out the cause.

I wonder if it’s because when using a Physics Engine, we should only be setting rotationQuaternion and not rotation

@RaananW would understand this better :slight_smile:

In this PG, a new rotationQuaternion is assigned:


Thanks for the playground. I ended up just using rotation.copyFrom, not sure if that has any other unintended consequences, but it looks to be play fine with physics.


When creating an impostor, the physics engine takes the current rotation from the .rotation object and transforms it to a rotationQuaternion, unless a rotationQuaternion is already available. Re-setting the .rotation object will not work (as you noticed), as the physics engine will take the old rotation. using copyFrom will keep the object and not re-create it, so it works. Setting the rotationQuaternion as @gbz mentioned would have worked as well :slight_smile: