Skip to content

Commit 2220b4d

Browse files
committed
Rotate gizmo with mouse wasn't correctly updating block values
Caused a visible change on drag release of gizmo. It wasn't updating all the Euler values which is currently needed. (Will revisit for a better quaternion approach in future) AI use: GPT 5.5 identified the issue. Fixed in an interactive session with Sonnet 4.6 with testing and consideration of different approaches.
1 parent 0e38519 commit 2220b4d

1 file changed

Lines changed: 1 addition & 29 deletions

File tree

ui/gizmos.js

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,25 +1604,6 @@ function handleRotationGizmo() {
16041604

16051605
onExit(() => gizmoManager.onAttachedToMeshObservable.remove(rotateObs));
16061606

1607-
// Track which axis ring is being dragged so only that axis is written to the block
1608-
let draggedAxis = null;
1609-
const rg = gizmoManager.gizmos.rotationGizmo;
1610-
const axisDragObservers = [];
1611-
[
1612-
{ gizmo: rg?.xGizmo, axis: 'x' },
1613-
{ gizmo: rg?.yGizmo, axis: 'y' },
1614-
{ gizmo: rg?.zGizmo, axis: 'z' },
1615-
].forEach(({ gizmo, axis }) => {
1616-
if (!gizmo?.dragBehavior) return;
1617-
const obs = gizmo.dragBehavior.onDragStartObservable.add(() => {
1618-
draggedAxis = axis;
1619-
});
1620-
axisDragObservers.push({ behavior: gizmo.dragBehavior, obs });
1621-
});
1622-
onExit(() => {
1623-
axisDragObservers.forEach(({ behavior, obs }) => behavior.onDragStartObservable.remove(obs));
1624-
});
1625-
16261607
const rotDragStart = gizmoManager.gizmos.rotationGizmo.onDragStartObservable.add(() => {
16271608
let mesh = gizmoManager.attachedMesh;
16281609
if (!mesh) return;
@@ -1656,16 +1637,7 @@ function handleRotationGizmo() {
16561637
mesh.physics.setMotionType(mesh.savedMotionType);
16571638
}
16581639

1659-
// Only update the axis that was dragged; fall back to all axes if unknown
1660-
const axisFilter = draggedAxis
1661-
? {
1662-
x: draggedAxis === 'x',
1663-
y: draggedAxis === 'y',
1664-
z: draggedAxis === 'z',
1665-
}
1666-
: null;
1667-
draggedAxis = null;
1668-
updateRotationBlock(mesh, axisFilter);
1640+
updateRotationBlock(mesh);
16691641
});
16701642

16711643
onExit(() => gizmoManager.gizmos.rotationGizmo.onDragEndObservable.remove(rotDragEnd));

0 commit comments

Comments
 (0)