Skip to content

Rotation on X and Z axes affect more than one axis value #582

@lawsie

Description

@lawsie

In the current released version (as well as main), using the mouse to drag a rotation on either X or Z axis results in more than one blockly block value being updated - i.e. if you rotate on X axis, all axis values are changed. This might be a known non-issue because maths, but recording it anyway.

To Reproduce

  1. Add a mesh
  2. Click the rotate gizmo
  3. Use the X axis to rotate the mesh and look at the values in the blockly block

This bug isn't present if you use keyboard rotation because it implements the rotation differently. I'm not sure if this is an issue or not in practice - it appears to be to do with the complexity of rotation in 3D space.

It's possible to make it work correctly for mouse drag on X and Y using the following in rotDragEnd() before updating the block, but Z still affects multiple values.

if (mesh.rotationQuaternion) {
        mesh.rotation = mesh.rotationQuaternion.toEulerAngles();
        mesh.rotationQuaternion = null;
}

Claude also said:

The real fix is to change the gizmo to local space: set updateToMatchAttachedMesh = true in the configureRotationGizmo call. In local space the gizmo rotates around the mesh's own axes, so the operation is Qy_existing * Qz_local_delta, which always decomposes cleanly back to only Z changing. I verified this with the actual numbers.

The tradeoff: in local space the rotation ring handles tilt with the mesh (they follow the mesh's orientation) rather than staying aligned with world up/right/forward. Whether that's acceptable depends on how you want the gizmo to feel to the user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions