Skip to main content

Module gizmo_interact

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§

GizmoDrag
A manipulation in progress: one grabbed handle, tracked across frames.
GizmoTransform
The transform an entity had when a drag began.

Enums§

GizmoAxis
One of the three manipulator handles.
GizmoDelta
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 axis and to each other.
pick_handle
The nearest handle whose geometry the ray passes within tolerance of, or None when the cursor is not over the manipulator.

Type Aliases§

GizmoBasis
World-space directions of the three handles, indexed by GizmoAxis::index.