pub trait LayerIndex:
Eq
+ Hash
+ Component
+ Clone
+ Debug {
// Required method
fn as_z_coordinate(&self) -> f32;
}
Expand description
Trait for the type you use to indicate your sprites’ layers. Add this as a component to any entity you want to treat as a sprite. Note that this does not propagate.
Required Methods§
Sourcefn as_z_coordinate(&self) -> f32
fn as_z_coordinate(&self) -> f32
The actual numeric z-value that the layer index corresponds to. Note
that the z-value for an entity can be any value in the range
layer.as_z_coordinate() <= z < layer.as_z_coordinate() + 1.0
, and the
exact values are an implementation detail!
With the default Bevy camera settings, your return values from this function should be between 0 and 999.0, since the camera is at z = 1000.0. Prefer smaller z-values since that gives more precision.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.