Trait extol_sprite_layer::LayerIndex

source ·
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§

source

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.

Object Safety§

This trait is not object safe.

Implementors§