Entities with an IndependentTransform
have a position relative to their parent, but aren't part of the Bevy Transform hierarchy.
With Transform
:
With IndependentTransform
:
Supports Bevy 0.8
#
Add the dependency to your Cargo.toml
toml
bevy_independent_transform = "0.1"
and the plugin to your App
rust
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(IndependentTransformPlugin)
// .. rest of App
run()
}
IndependentTransform
is a newtype wrapping Transform
.
Like Transform
, an entity with a IndependentTransform
must also have a GlobalTransform
.
You can insert an IndependentTransform
component directly, or spawn one of the bundles included with this crate:
* IndependentSpriteBundle
* IndependentSpriteSheetBundle
* IndependentText2dBundle
* IndependentTransformBundle
If an entity has both IndependentTransform
and Transform
components, the IndependentTransform
component will be ignored.
cargo run --example text
cargo run --example sprites