bevy_transform_tools 0.3.0

A transform gizmo plugin for Bevy with translation, rotation, and scale handles
Documentation
  • Coverage
  • 100%
    105 out of 105 items documented0 out of 1 items with examples
  • Size
  • Source code size: 766.41 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.91 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2m 29s Average build duration of successful builds.
  • all releases: 2m 29s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • 8th-Boundary/bevy_transform_tools
    9 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • 8th-Boundary

bevy_transform_tools

Bevy Transform Tools

Crates.io Docs.rs MIT License

A transform gizmo plugin for Bevy that provides interactive translation, rotation, and scale handles for 3D entities.

Features

  • Translation - Move entities along axes (arrows) or planes (rectangles)
  • Rotation - Rotate entities around any axis (arc handles)
  • Scaling - Scale entities per-axis (cubes) or uniformly (center square)
  • Coordinate Spaces - World or local space manipulation
  • Snap-to-Grid - Optional snapping for translation, rotation, and scale
  • Customizable - Full control over colors, sizes, and visibility

Bevy Compatibility

bevy_transform_tools version Supported Bevy version
0.3.0 0.19.x
0.2.0 0.18.x
0.1.0 0.17.x

Installation

[dependencies]
bevy_transform_tools = "0.3"

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 - just add GizmoActive!
    commands.spawn((
        Transform::from_xyz(0.0, 1.0, 0.0),
        TransformGizmoTarget,
        GizmoActive,
    ));
}

Switching Selection

To change which entity has the gizmo, move the GizmoActive component:

fn switch_target(mut commands: Commands, old: Entity, new: Entity) {
    commands.entity(old).remove::<GizmoActive>();
    commands.entity(new).insert(GizmoActive);
}

Configuration

TransformGizmoState

Control the gizmo mode:

fn switch_mode(mut state: ResMut<TransformGizmoState>) {
    state.mode = TransformGizmoMode::Rotate;
    state.space = TransformGizmoSpace::World;
}

TransformGizmoStyle

Customize appearance:

fn customize_style(mut style: ResMut<TransformGizmoStyle>) {
    style.show_rotate = false;
    style.axis_length = 3.0;
    style.line_width = 2.0;
}

TransformGizmoSnap

Enable snap-to-grid:

fn enable_snapping(mut snap: ResMut<TransformGizmoSnap>) {
    snap.translate = AxisSnap::uniform(0.5);
    snap.rotate = AxisSnap::uniform(15f32.to_radians());
}

Examples

cargo run --example single_entity      # Basic usage

cargo run --example multi_gizmos       # Multiple gizmo targets
cargo run --example multiple_entities  # Multi-selection with pivot

License

MIT License - see LICENSE for details.