#bevy #gamedev


A 2D Transform component for The Bevy game-engine

4 releases (2 breaking)

Uses new Rust 2021

0.3.0 Nov 18, 2022
0.2.0 Aug 18, 2022
0.1.1 Jul 15, 2022
0.1.0 Jul 15, 2022

#297 in Game dev

41 downloads per month


274 lines

Bevy Mod Transform2d

Crates.io MIT/Apache 2.0

A 2D Transform component for Bevy.


Add the dependency to your Cargo.toml

bevy_mod_transform2d = "0.3"


use bevy::prelude::*;
use bevy_mod_transform2d::prelude::*;

fn main() {
        // Add the Transform2dPlugin

fn setup(mut commands: Commands) {

        SpriteBundle {
            sprite: Sprite {
                custom_size: Some(Vec2::splat(50.)),
        // Add a Transform2d component
        Transform2d::from_xy(200., 0.),

// Make the sprite orbit the center using the 2d transform.
fn orbit(mut query: Query<&mut Transform2d, With<Sprite>>, time: Res<Time>) {
    for mut transform in &mut query {
        // No quaternions in sight!
        transform.rotate_around(Vec2::ZERO, time.delta_seconds());

Take a look at the other examples.

Version table.

Bevy transform2d
0.9 0.3
0.8 0.2
0.7 0.1

Further details

Note that the Transform2d component does not replace Transform component, instead it writes to it. The Transform and GlobalTransform components are required for Transform2d to function.

See bevy_mod_2d_hierarchy for an alternative plugin that does not require the Transform component. Note that, for this reason, bevy_mod_2d_hierarchy is not compatible with crates that interact with Transform (eg. bevy_rapier2d), and does not support parenting 3D transforms to 2D ones (useful for 2.5D games).

Intergration with other crates

To integrate with another library that modifies Transform the state of Transform and Transform2d will need to be synchronised at the right times.

An intergration with bevy_rapier2d is included and can be enabled as a feature:

bevy_mod_transform2d = { version = "0.3", features = ["bevy_rapier2d"] }

If there is another plugin that interacts with the transform here's how you would synchronise the state to make Transform2d compatible with that plugin.

  • When a system needs to read from Transfrom add the provided sync_transform_2d_to_3d system before it.
  • When a system writes to Transfrom add the provided sync_transform_3d_to_2d system after it.


Licensed under either of Apache License, Version 2.0 or MIT license at your option. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~428K SLoC