Module gizmo_interact
Expand description
Gizmo manipulation — grabbing a handle and turning cursor motion into a transform delta.
No ECS, no rendering, no input plumbing: the editor supplies a cursor
Ray plus the world-space frame of the manipulator, and this module
answers which handle is under the cursor and how far it has been
dragged. That keeps the part most likely to be subtly wrong — the
manipulation semantics — testable without a window. The intersection math
underneath belongs to Ray, not here.
Handles are world-aligned for Move and Rotate, object-aligned for
Scale. That is the convention every DCC settled on, and not arbitrarily:
a world-aligned scale handle on a rotated object would have to shear it to
mean anything, which a Transform cannot represent.
Deltas are expressed relative to the transform each entity had when the drag
began (GizmoDelta::apply) rather than accumulated frame by frame, so a
long drag cannot drift away from where the cursor says it should be.
Structs§
- Gizmo
Drag - A manipulation in progress: one grabbed handle, tracked across frames.
- Gizmo
Transform - The transform an entity had when a drag began.
Enums§
- Gizmo
Axis - One of the three manipulator handles.
- Gizmo
Delta - What a drag has done so far, in world space, relative to the drag’s start.
Functions§
- gizmo_
basis - The frame the handles are drawn and dragged in for
mode. - perpendiculars
- A stable pair of unit axes perpendicular to
axisand to each other. - pick_
handle - The nearest handle whose geometry the ray passes within tolerance of, or
Nonewhen the cursor is not over the manipulator.
Type Aliases§
- Gizmo
Basis - World-space directions of the three handles, indexed by
GizmoAxis::index.