Struct heron::prelude::Acceleration[][src]

pub struct Acceleration {
    pub linear: Vec3,
    pub angular: AxisAngle,
}

Component that defines the linear and angular acceleration.

The linear part is in “unit” per second squared on each axis, represented as a Vec3. (The unit, being your game unit, be it pixel or anything else) The angular part is in radians per second squared around an axis, represented as an AxisAngle

Example


fn spawn(mut commands: Commands) {
    commands.spawn_bundle(todo!("Spawn your sprite/mesh, incl. at least a GlobalTransform"))
        .insert(Body::Sphere { radius: 1.0 })
        .insert(
            Acceleration::from_linear(Vec3::X * 1.0)
                .with_angular(AxisAngle::new(Vec3::Z, 0.05 * PI))
        );
}

Fields

linear: Vec3

Linear acceleration in units-per-second-squared on each axis

angular: AxisAngle

Angular acceleration in radians-per-second-squared around an axis

Implementations

impl Acceleration[src]

#[must_use]
pub fn from_linear(linear: Vec3) -> Acceleration
[src]

Returns a linear acceleration from a vector

#[must_use]
pub fn from_angular(angular: AxisAngle) -> Acceleration
[src]

Returns an angular acceleration from a vector

#[must_use]
pub fn with_linear(self, linear: Vec3) -> Acceleration
[src]

Returns a new version with the given linear acceleration

#[must_use]
pub fn with_angular(self, angular: AxisAngle) -> Acceleration
[src]

Returns a new version with the given angular acceleration

Trait Implementations

impl Clone for Acceleration[src]

impl Copy for Acceleration[src]

impl Debug for Acceleration[src]

impl Default for Acceleration[src]

impl From<Acceleration> for AxisAngle[src]

impl From<AxisAngle> for Acceleration[src]

impl From<Quat> for Acceleration[src]

impl From<Vec2> for Acceleration[src]

impl From<Vec3> for Acceleration[src]

impl NearZero for Acceleration[src]

impl PartialEq<Acceleration> for Acceleration[src]

impl StructuralPartialEq for Acceleration[src]

Auto Trait Implementations

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> 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<T> Scalar for T where
    T: Copy + PartialEq<T> + Debug + Any
[src]

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>,