Enum heron_core::Body[][src]

pub enum Body {
    Sphere {
        radius: f32,
    },
    Capsule {
        half_segment: f32,
        radius: f32,
    },
    Cuboid {
        half_extends: Vec3,
    },
}

Components that defines a body subject to physics and collision

Example

fn spawn(commands: &mut Commands, mut materials: ResMut<Assets<ColorMaterial>>) {
    commands.spawn(todo!("Spawn your sprite/mesh, incl. at least a GlobalTransform"))
        .with(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

Trait Implementations

impl Clone for Body[src]

impl Debug for Body[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

impl<T> Downcast for T where
    T: Any

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

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

impl<T> Instrument for T[src]

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

impl<T> Resource for T where
    T: 'static + Send + Sync
[src]

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<V, T> VZip<V> for T where
    V: MultiLane<T>,