Skip to main content

Crate bevy_transform_tools

Crate bevy_transform_tools 

Source
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:

Structs§

AxisColors
Colors for each axis (X, Y, Z) of a gizmo handle group.
AxisSnap
Optional per-axis snapping increments.
AxisToggles
Per-axis enable/disable toggles for gizmo handles.
GizmoActive
Marks a TransformGizmoTarget as the currently active/selected target.
GizmoStateColors
Colors for a single gizmo element in different interaction states.
TransformGizmoCamera
Marker component for cameras used by the transform gizmo.
TransformGizmoDrag
Information about an active drag operation.
TransformGizmoPlugin
Plugin that enables the transform gizmo system.
TransformGizmoSnap
Snapping configuration for all transform operations.
TransformGizmoState
Global state for the transform gizmo system.
TransformGizmoStyle
Visual style and sizing configuration for the transform gizmo.
TransformGizmoTarget
Marks an entity as controllable by the transform gizmo.

Enums§

GizmoAxis
Identifies which axis (X, Y, or Z) a gizmo handle operates on.
GizmoOperation
The type of operation being performed by the gizmo.
TransformGizmoMode
Which transform component the gizmo is currently editing for UI purposes.
TransformGizmoSpace
Coordinate space used by the gizmo axes.