| Crates.io | reactor_spatial |
| lib.rs | reactor_spatial |
| version | 1.0.0 |
| created_at | 2024-07-21 17:25:37.031505+00 |
| updated_at | 2024-07-21 17:25:37.031505+00 |
| description | A set of 2D spatial utilities for Bevy, including handling transform propagation |
| homepage | https://www.cobaltreactor.com |
| repository | https://github.com/BobG1983/cobalt_reactor |
| max_upload_size | |
| id | 1310468 |
| size | 152,253 |
reactor_spatialA 2d transform system for the Bevy game engine that supports Transform propagation controls.
Position2DThe Position2D struct represents a 2D point in space. It has two fields: x and y, representing the Cartesian coordinates of the point.
Rotation2DThe Rotation2D struct represents a 2D rotation. It can be used with either radians or degrees.
Scale2DThe Scale2D struct represents a 2D scale. It has two fields: x and y, representing the scale factors for the x and y axes respectively.
SpatialBundle2DThe SpatialBundle2D struct represents the spatial state of a transform in 2D. It contains a Position2D, Rotation2D, and Scale2D. It provides a convenient way to store and manipulate the spatial state of your game objects.
When you add a SpatialBundle2D to an entity, it will also automatically add a SpatialBundle, making it easy to use the spatial 2D system with Bevy's built-in transform system.
DrawOrderThe DrawOrder struct is used to specify the draw layering of entities in your game. It is a wrapper over an f32, with higher values drawing above lower values.
The following enums are used to control how the spatial components of an entity are propagated to its children.
PositionPropagationThe PositionPropagation enum has two variants:
Relative: **[Default]**The position of a child entity is relative to its parent's position.
Absolute: The position of a child entity is absolute and does not take into account its parent's position.
RotationPropagationThe RotationPropagation enum has two variants:
Relative: **[Default]**The rotation of a child entity is relative to its parent's rotation.
Absolute: The rotation of a child entity is absolute and does not take into account its parent's rotation.
By default, both PositionPropagation and RotationPropagation are set to Relative.
ScalePropagationThe ScalePropagation enum has two variants:
Relative: **[Default]**The rotation of a child entity is relative to its parent's rotation.
Absolute: The rotation of a child entity is absolute and does not take into account its parent's rotation.
In addition to the above, and not included in the SpatialBundle2D are Compass, CompassRose, and CompassHalfwinds. It is very common in 2D games to need to know the compass direction a given entity is facing in order to choose which sprite to draw. These enums can be included as a component on anything with a Rotation2D, and as part of transform propagation, there values will be updated to match the objects rotation.
serde - Adds impls for serde:Serialize and serde:DeserializeAdd the crate to your Cargo.toml
Add SpatialPlugin to your app.