Skip to main content

Module transform_gizmo

Module transform_gizmo 

Source
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

  1. Add TransformGizmoPlugin to your app.
  2. Mark the camera with TransformGizmoCamera.
  3. 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§

TransformGizmoCamera
Marker component for the camera the transform gizmo should use.
TransformGizmoFocus
Component that marks the entity the transform gizmo operates on.
TransformGizmoMeshMarker
Marker component for individual gizmo mesh parts.
TransformGizmoPlugin
Opt-in plugin that adds the interactive transform gizmo.
TransformGizmoRoot
Marker component for the root entity of the gizmo mesh hierarchy.
TransformGizmoSettings
Configuration and preferences for the transform gizmo.
TransformGizmoState
Runtime state of the transform gizmo (drag and hover).
TransformGizmoSystems
System set for the transform gizmo. All transform gizmo systems run in PostUpdate within this set.

Enums§

TransformGizmoAxis
Which axis the user is interacting with.
TransformGizmoMode
Which manipulation mode the gizmo is in.
TransformGizmoSpace
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.