Struct ark_api::world::Bounds

source ·
pub struct Bounds { /* private fields */ }
Expand description

Bounds component.

Use to set custom bounds or read bounds defined by a mesh.

If an entity has a render component and it doesn’t exist it will be added and set to match the mesh, but will be available a frame later.

Implementations§

source§

impl Bounds

source

pub fn bounding_box(&self) -> BoundingBox

Get the local space bounding box.

Convenience for calling Self::bounding_box_min and Self::bounding_box_max.

source

pub fn set_bounding_box(&self, bbox: BoundingBox)

Set the local space bounding box.

Convenience for calling Self::bounding_box_min and Self::bounding_box_max.

source§

impl Bounds

source

pub fn bounding_box_min(&self) -> ValueAccessorReadWriteAnimate<Vec3>

Returns a ValueAccessor for the bounding box min of the entity.

Used to set/get/animate the min.

For physics this will be used when the body is setup, for spatial queries it will be used as is.

source

pub fn bounding_box_max(&self) -> ValueAccessorReadWriteAnimate<Vec3>

Returns a ValueAccessor for the bounding box max of the entity.

Used to set/get/animate the max.

For physics this will be used when the body is setup, for spatial queries it will be used as is.

source

pub fn bounding_sphere_radius(&self) -> ValueAccessorReadWriteAnimate<f32>

Returns a ValueAccessor for the bounding sphere radius of the entity.

Used to set/get/animate the radius.

For physics this will be used when the body is setup, for spatial queries it will be used as is.

source

pub fn match_render_shape(&self) -> ValueAccessorReadWrite<bool>

Returns a ValueAccessor for the match render shape toggle of the entity.

Used to set/get whether these bounds will match the render shape.

Set this to false if you want to set a custom bounding shape, box or sphere when the entity has a render component with a shape set.

source

pub fn shape(&self) -> ValueAccessorDataReadWrite<Shape>

Returns a ValueAccessor for the bounding shape of the entity.

Used to set/get the bounding shape.

Use this to set a custom collider/physics/spatial query shape with MatchRenderShape set to false.

source

pub fn create_sphere_bounds(&self, radius: f32)

Convenience method to set up both the sphere and the bounding box to contain a certain radius.

Trait Implementations§

source§

impl ComponentTrait for Bounds

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 Bounds

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.