pub struct Layer { /* private fields */ }
Expand description
Layer component.
Use to group and identify entities. An added layer to an entity will have its mask initialized to 1 (belonging to the first layer).
Implementations
sourceimpl Layer
impl Layer
sourcepub fn mask(&self) -> ValueAccessorReadWrite<u64>
pub fn mask(&self) -> ValueAccessorReadWrite<u64>
Returns a ValueAccessor
for the layer mask of the entity.
Used to set/get the layer mask. It is a bit mask that can be used for filtering collisions, spatial queries among other things.
sourcepub fn set_single(&mut self, index: usize)
pub fn set_single(&mut self, index: usize)
Utility function to set to a single layer (an entity can be a member of multiple).
sourcepub const fn mask_from_index(index: usize) -> u64
pub const fn mask_from_index(index: usize) -> u64
Generates a layer mask from an index (max index is 63)
Trait Implementations
sourceimpl ComponentTrait for Layer
impl ComponentTrait for Layer
sourcefn get_type() -> ComponentType
fn get_type() -> ComponentType
The type of the component, as a ComponentType
enum.
sourcefn from_entity(handle: Entity) -> Self
fn from_entity(handle: Entity) -> Self
Adopt an Entity
, wrap in a component struct.
Auto Trait Implementations
impl RefUnwindSafe for Layer
impl Send for Layer
impl Sync for Layer
impl Unpin for Layer
impl UnwindSafe for Layer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more