Expand description
Interactive transform gizmo for translating, rotating, and scaling entities.
This module provides an opt-in transform gizmo that renders visual handles on a
focused entity, allowing the user to click-and-drag to translate, rotate, or scale
it. The plugin does not handle keyboard input – users set
TransformGizmoSettings::mode however they like (keyboard shortcuts, UI buttons,
gamepad, etc.).
§Quick start
- Add
TransformGizmoPluginto your app. - Mark the camera with
TransformGizmoCamera. - Tag the entity you want to manipulate with
TransformGizmoFocus.
If there is exactly one camera in the world, the TransformGizmoCamera marker
is optional – the gizmo will use that camera automatically. When multiple cameras
exist, the marker is required so the gizmo knows which one to use.
Structs§
- Transform
Gizmo Camera - Marker component for the camera the transform gizmo should use.
- Transform
Gizmo Focus - Component that marks the entity the transform gizmo operates on.
- Transform
Gizmo Mesh Marker - Marker component for individual gizmo mesh parts.
- Transform
Gizmo Plugin - Opt-in plugin that adds the interactive transform gizmo.
- Transform
Gizmo Root - Marker component for the root entity of the gizmo mesh hierarchy.
- Transform
Gizmo Settings - Configuration and preferences for the transform gizmo.
- Transform
Gizmo State - Runtime state of the transform gizmo (drag and hover).
- Transform
Gizmo Systems - System set for the transform gizmo. All transform gizmo systems run in
PostUpdatewithin this set.
Enums§
- Transform
Gizmo Axis - Which axis the user is interacting with.
- Transform
Gizmo Mode - Which manipulation mode the gizmo is in.
- Transform
Gizmo Space - Whether the gizmo transforms the object using world or local space axes.
Constants§
- AXIS_
HIT_ DISTANCE - Default screen-space pixel distance threshold for hover detection.
- AXIS_
LENGTH - Default length of each axis handle.
- AXIS_
START_ OFFSET - Gap between the gizmo center and the start of each axis handle.
- AXIS_
TIP_ LENGTH - Length of the arrow tip on translate handles.
- COLOR_
VIEW - Color for the view-plane handle (white).
- COLOR_X
- Color for the X axis (magenta-pink).
- COLOR_Y
- Color for the Y axis (green).
- COLOR_Z
- Color for the Z axis (blue).
- CONE_
HEIGHT - Height of the cone mesh used for translate arrow tips.
- CONE_
RADIUS - Radius of the cone mesh used for translate arrow tips.
- INACTIVE_
ALPHA - Alpha value used for inactive (non-hovered) axes during a drag.
- ROTATE_
RING_ RADIUS - Default radius of the rotation rings.
- SCALE_
CUBE_ SIZE - Half-size of the scale cube tip.
- SHAFT_
LENGTH - Height of the cylinder mesh used for axis shafts.
- SHAFT_
RADIUS - Radius of the cylinder mesh used for axis shafts.
- VIEW_
CIRCLE_ MAJOR - Major (ring) radius of the view-plane circle torus.
- VIEW_
CIRCLE_ MINOR - Minor (tube) radius of the view-plane circle torus.
- VIEW_
RING_ MAJOR - Major (ring) radius of the view-axis rotation ring torus.
- VIEW_
RING_ MINOR - Minor (tube) radius of the view-axis rotation ring torus.
Functions§
- axis_
direction - Get the world-space direction for a given axis.
- effective_
space - Return the effective space for the gizmo: scale always uses local space.
- gizmo_
rotation - Compute the gizmo rotation based on the space setting.
- intersect_
plane - Intersect a ray with a plane defined by a normal and a point on the plane.
- point_
to_ ring_ screen_ dist - Minimum screen-space distance from a cursor position to a 3D ring projected onto screen.
- point_
to_ segment_ dist - Distance from a point to a line segment in 2D.
- translation_
plane_ normal - Construct the constraint plane normal for axis translation/scale.