Expand description
Transform gizmo plugin for Bevy 0.19.x.
This crate provides a 3D transform gizmo for manipulating entity transforms in Bevy applications. It supports translation, rotation, and scaling with both world and local coordinate spaces.
§Quick Start
ⓘ
use bevy::prelude::*;
use bevy_transform_tools::{
TransformGizmoPlugin, TransformGizmoCamera, TransformGizmoTarget, GizmoActive,
};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(TransformGizmoPlugin)
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
// Camera with gizmo support
commands.spawn((
Camera3d::default(),
Transform::from_xyz(0.0, 5.0, 10.0).looking_at(Vec3::ZERO, Vec3::Y),
TransformGizmoCamera,
));
// Entity with active gizmo
commands.spawn((
Transform::from_xyz(0.0, 1.0, 0.0),
TransformGizmoTarget,
GizmoActive, // This entity has the gizmo
));
}§Features
- Translation: Move entities along axes or planes (XY, XZ, YZ)
- Rotation: Rotate entities around any axis
- Scaling: Scale entities per-axis or uniformly
- Coordinate Spaces: World or local space manipulation
- Snap-to-Grid: Optional snapping for precise positioning
- Customizable: Full control over colors, sizes, and visibility
§Configuration
The gizmo can be configured through several resources:
TransformGizmoState: Current mode, selected target, and drag stateTransformGizmoStyle: Visual appearance (colors, sizes, visibility)TransformGizmoSnap: Snap-to-grid increments for each operation
Structs§
- Axis
Colors - Colors for each axis (X, Y, Z) of a gizmo handle group.
- Axis
Snap - Optional per-axis snapping increments.
- Axis
Toggles - Per-axis enable/disable toggles for gizmo handles.
- Gizmo
Active - Marks a
TransformGizmoTargetas the currently active/selected target. - Gizmo
State Colors - Colors for a single gizmo element in different interaction states.
- Transform
Gizmo Camera - Marker component for cameras used by the transform gizmo.
- Transform
Gizmo Drag - Information about an active drag operation.
- Transform
Gizmo Plugin - Plugin that enables the transform gizmo system.
- Transform
Gizmo Snap - Snapping configuration for all transform operations.
- Transform
Gizmo State - Global state for the transform gizmo system.
- Transform
Gizmo Style - Visual style and sizing configuration for the transform gizmo.
- Transform
Gizmo Target - Marks an entity as controllable by the transform gizmo.
Enums§
- Gizmo
Axis - Identifies which axis (X, Y, or Z) a gizmo handle operates on.
- Gizmo
Operation - The type of operation being performed by the gizmo.
- Transform
Gizmo Mode - Which transform component the gizmo is currently editing for UI purposes.
- Transform
Gizmo Space - Coordinate space used by the gizmo axes.