Rotation Gizmo with previous quaternion set in code

Hello,

I believe I may have found a bug with the rotation gizmo.

If I have a mesh with a previously set quaternion rotation, and then attempt to use the rotation gizmo on that mesh, I am getting this in the console: Uncaught TypeError: c.attachedMesh.rotationQuaternion.toRotationMatrix is not a function

I am not sure if I am doing something wrong, or if this is a legit bug.

Here is a demo I adapted from the GizmoManager example: https://www.babylonjs-playground.com/#4TBMBR#28

(All I changed was adding line 13. Just try to rotate any of the spheres)

Pinging @trevordev

Hey @Jonathan_Face,

The way this gizmo works is when you start dragging the drag axis for mouse movement is along the initial drag angle and while you drag along that axis (which is a strait line) the object will spin.
image
The problem occurs at weird angles like in your playground
image
the axis logic is still the same and dragging along this axis works but I could see how this behavior may be expected
image
but this wouldn’t work for the initial picture because you cant drag a strait line in a circle, I could add special angle logic but I would prefer if it works consistent in this case if what I am saying makes sense.

1 Like

Thanks for looking into this.

Your screenshots are of the bounding box gizmo… I was referring to the rotational one. Sorry, I should have stripped the other gizmos out of the example. Is what you’re saying true of both?

Here, I removed the extraneous gizmos:
https://www.babylonjs-playground.com/#4TBMBR#29

Oh haha,

Try this playground https://www.babylonjs-playground.com/#4TBMBR#31

A vector4 is being assigned instead of a Quaternion, changed it and it should work now.

1 Like

d’oh! Thank you very much!