Rotation Gizmo with previous quaternion set in code


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:

(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.
The problem occurs at weird angles like in your playground
the axis logic is still the same and dragging along this axis works but I could see how this behavior may be expected
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:

Oh haha,

Try this playground

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

1 Like

d’oh! Thank you very much!