Struct ark_api::world::Layer

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

source§

impl Layer

source

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.

source

pub fn set_single(&mut self, index: usize)

Utility function to set to a single layer (an entity can be a member of multiple).

source

pub const fn mask_from_index(index: usize) -> u64

Generates a layer mask from an index (max index is 63)

Trait Implementations§

source§

impl ComponentTrait for Layer

source§

fn get_type() -> ComponentType

The type of the component, as a ComponentType enum.
source§

fn from_entity(handle: Entity) -> Self

Adopt an Entity, wrap in a component struct.
source§

fn try_from_entity(handle: Entity) -> Option<Self>

Try to adopt an Entity, wrapping it in a component struct.
source§

fn entity(&self) -> Entity

Get the entity that the component belongs to.
source§

impl Debug for Layer

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.