Fix rotation gizmo to sync quaternion with Euler angles#583
Fix rotation gizmo to sync quaternion with Euler angles#583tracygardner merged 1 commit intomainfrom
Conversation
Switch to local space (updateToMatchAttachedMesh: true) so each gizmo ring rotates around the mesh's own axis, preventing Euler decomposition from spreading across multiple components. Also clear rotationQuaternion before reading back to Euler in rotDragEnd, matching the keyboard rotation approach. Fixes #582 https://claude.ai/code/session_015w2ie2ZbMdLcLRi7Kk4Rhm
📝 WalkthroughWalkthroughRotation gizmo initialization now passes Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
ui/gizmos.js (1)
1-1:⚠️ Potential issue | 🟡 MinorRun Prettier to clear CI failure.
The pipeline reports a Prettier mismatch, so formatting needs to be normalized before merge.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ui/gizmos.js` at line 1, This file fails CI due to Prettier formatting; run the project's Prettier (e.g., npx prettier --write) against the file that contains the import line "import * as Blockly from \"blockly\";" (ui/gizmos.js) to normalize formatting, then stage and commit the formatted changes so the pipeline passes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@ui/gizmos.js`:
- Line 1: This file fails CI due to Prettier formatting; run the project's
Prettier (e.g., npx prettier --write) against the file that contains the import
line "import * as Blockly from \"blockly\";" (ui/gizmos.js) to normalize
formatting, then stage and commit the formatted changes so the pipeline passes.
Summary
Fixed the rotation gizmo to properly synchronize mesh rotation state by converting quaternion-based rotations back to Euler angles after interaction.
Key Changes
configureRotationGizmo()call to pass{ updateToMatchAttachedMesh: true }option, ensuring the gizmo stays synchronized with the mesh's current rotation statemesh.rotationQuaternionto Euler angles and assigns tomesh.rotationImplementation Details
The fix addresses a rotation state inconsistency where meshes using quaternion-based rotation could end up with misaligned rotation representations. By converting quaternions back to Euler angles after gizmo interaction and clearing the quaternion property, we ensure a single source of truth for the mesh's rotation state, which is then properly reflected in the Blockly rotation block update.
https://claude.ai/code/session_015w2ie2ZbMdLcLRi7Kk4Rhm
Summary by CodeRabbit