PlaneRotationGizmo - use rotation if quaternion is null

Hey guys,
Could we update PlaneRotationGizmo to use mesh.rotation if no quaternion is set?
Currently it forces a change to use mesh.rotationQuaternion.

To avoid issues with back-compat,
perhaps a (parent) RotationGizmo.useQuaternion property (default true) which switches to a different dragBehavior function for each child gizmo when changed ?

…and if you’re unaware of this (like me) and mindlessly use mesh.rotation in the rest of your code, it bugs out and you spend an hour wondering what’s going on :thinking: … while thinking it looks perfectly fine and should work :smile:

Pinging @Cedric

I’m taking a look

cool, thanks! :slight_smile:

Hi @aWeirdo
I’m not sure about the change. Correct me if I’m wrong: I guess your tried to read back mesh.rotation after doing some rotation using the gizmo and it was out of sync?
If it’s what happen, I’d prefer add a synchronization system to update mesh.rotation from the quaternion instead of changing the gizmo to work on euler.

I did a simple change to always use the Euler angle here when an option constructor Boolean is set to true:
‘’’


‘’’

I keep the calculation with the quaternion and set back the Euler angle here :
‘’’


‘’’

But the Mesh.rotationQuaternion is not updated once you change the Mesh.rotation with code. Only the Quaternion to Euler works when using the Gizmo. So the 2 rotations are out of sync. Which might not be what you want ?

Hi @Cedric
Thank you, i think this could work.
I only have my phone atm, but i’ll look at it tomorrow.

Great! Then, I’ll do a PR if that’s what you need. :slight_smile:

1 Like

Hi @Cedric, I apologize for my poor responsiveness, busy few days.
Did you make any progress on this? :slight_smile: i was unable to find a PR.

Hi @aWeirdo

I’m making the PR today

1 Like

ok.
I made a local fix which i just updated & threw in a PG, as i was unsure if you had gotten around to it yet :slight_smile: not fully back-compat.

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

Here is the PR:

1 Like

@aWeirdo It’s merged. It will be in nightly tomorrow