Fix transform gizmo local translation snapping (#24486)
# Objective Fixes #24431. When translation snapping is enabled, the transform gizmo currently snaps world-space position components with `snap_axis`. This works for world-aligned axes, but breaks local-space translation on rotated entities because a local axis can affect multiple world-space components. ## Solution Snap the scalar drag distance along the selected gizmo axis instead of snapping `x/y/z` position components. This keeps snapping aligned with the actual drag axis in both world and local space. ## Testing - `cargo check` in a local example using `TransformGizmoPlugin` - `cargo fmt -p bevy_gizmos --check` - I ran the reproduction actions from #24431 and verified the issue before applying the fix: with a rotated object in local space, translation snapping moved the object along world-space components instead of the displayed local gizmo axis. After applying this change, I repeated the same steps and confirmed that snapped translation follows the selected local axis as expected.
V
Vitaliy Sapronenko committed
7cddefff03a67d6cdfc7c744ce5df8a5e119f8cc
Parent: 85a892a
Committed by GitHub <noreply@github.com>
on 5/29/2026, 10:39:46 PM