Enum heron::Body[][src]

pub enum Body {
    Sphere {
        radius: f32,
    },
    Capsule {
        half_segment: f32,
        radius: f32,
    },
    Cuboid {
        half_extends: Vec3,
    },
    ConvexHull {
        points: Vec<Vec3, Global>,
    },
}

Components that defines a body subject to physics and collision

Example

fn spawn(mut commands: Commands, mut materials: ResMut<Assets<ColorMaterial>>) {
    commands.spawn_bundle(todo!("Spawn your sprite/mesh, incl. at least a GlobalTransform"))
        .insert(Body::Sphere { radius: 1.0 });
}

Variants

Sphere

A sphere (or circle in 2d) shape defined by its radius

Fields of Sphere

radius: f32

Radius of the sphere

Capsule

A capsule shape

Fields of Capsule

half_segment: f32

Distance from the center of the capsule to the center of an hemisphere.

radius: f32

Radius of the hemispheres

Cuboid

A cuboid/rectangular shape

Fields of Cuboid

half_extends: Vec3

The half extends on each axis. (x = half width, y = half height, z = half depth)

In 2d the z axis is ignored

ConvexHull

A convex polygon/polyhedron shape

Fields of ConvexHull

points: Vec<Vec3, Global>

A vector of points describing the convex hull

Trait Implementations

impl Clone for Body[src]

impl Debug for Body[src]

impl Default for Body[src]

impl GetTypeRegistration for Body[src]

impl Reflect for Body[src]

Auto Trait Implementations

impl RefUnwindSafe for Body

impl Send for Body

impl Sync for Body

impl Unpin for Body

impl UnwindSafe for Body

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CloneAny for T where
    T: Any + Clone

impl<T> Component for T where
    T: 'static + Send + Sync

impl<T> Downcast for T where
    T: Any

impl<T> Downcast<T> for T

impl<T> DowncastSync for T where
    T: Any + Send + Sync

impl<T> From<T> for T[src]

impl<T> FromWorld for T where
    T: Default

impl<T> GetPath for T where
    T: Reflect, 

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> TypeData for T where
    T: 'static + Send + Sync + Clone

impl<T> Upcast<T> for T

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,