bevy_transform_tools


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) {
commands.spawn((
Camera3d::default(),
Transform::from_xyz(0.0, 5.0, 10.0).looking_at(Vec3::ZERO, Vec3::Y),
TransformGizmoCamera,
));
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 cargo run --example multi_gizmos cargo run --example multiple_entities
License
MIT License - see LICENSE for details.