Trait bevy_mod_bounding::BoundingVolume[][src]

pub trait BoundingVolume {
    fn new(mesh: &Mesh, transform: &GlobalTransform) -> Self;
fn new_debug_mesh(&self, transform: &GlobalTransform) -> Mesh;
fn update_on_transform_change(
        &self,
        _mesh: &Mesh,
        _transform: &GlobalTransform
    ) -> Option<Self>
    where
        Self: Sized
;
fn outside_plane(
        &self,
        bound_vol_position: &GlobalTransform,
        point: Vec3,
        normal: Vec3
    ) -> bool; }

A BoundingVolume stores its properties in mesh space to maximize precision. Because some types of bounding volume must be recomputed if the mesh is scaled or rotated, this trait calls an update function depending on whether the mesh or transform has updated.

Required methods

fn new(mesh: &Mesh, transform: &GlobalTransform) -> Self[src]

Initializes a valid bounding volume given a [Mesh] and [GlobalTransform].

fn new_debug_mesh(&self, transform: &GlobalTransform) -> Mesh[src]

Generate a debug [Mesh] representing the bounding volume from a BoundingVolume.

fn update_on_transform_change(
    &self,
    _mesh: &Mesh,
    _transform: &GlobalTransform
) -> Option<Self> where
    Self: Sized
[src]

This function is only called when only the entity’s [GlobalTransform] has changed. Only some types of bounding volume need to be recomputed in this case.

fn outside_plane(
    &self,
    bound_vol_position: &GlobalTransform,
    point: Vec3,
    normal: Vec3
) -> bool
[src]

Returns true iff the bounding mesh is entirely on the outside of the supplied plane. “Outside” is the direction that the plane normal points to.

Loading content...

Implementors

impl BoundingVolume for Aabb[src]

impl BoundingVolume for Obb[src]

impl BoundingVolume for BSphere[src]

Create a valid boundary sphere from a mesh and globaltransform.

fn new_debug_mesh(&self, transform: &GlobalTransform) -> Mesh[src]

Generate a debug mesh, and apply the inverse transform. Because the debug mesh is a child, the transform of the parent will be applied to it. This needs to be negated so the bounding circle debug mesh isn’t warped.

Loading content...