Struct heron_core::RotationConstraints[][src]

pub struct RotationConstraints {
    pub allow_x: bool,
    pub allow_y: bool,
    pub allow_z: bool,
}

Component that restrict what rotations can be caused by forces.

Note that angular velocity may still be applied programmatically. This only restrict how rotation can change when force/torques are applied.

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(RotationConstraints::lock()); // Prevent rotation caused by forces
}

Fields

allow_x: bool

Set to true to prevent rotations around the x axis

allow_y: bool

Set to true to prevent rotations around the y axis

allow_z: bool

Set to true to prevent rotations around the Z axis

Implementations

impl RotationConstraints[src]

#[must_use]
pub fn lock() -> Self
[src]

Lock rotations around all axes

#[must_use]
pub fn allow() -> Self
[src]

Allow rotations around all axes

#[must_use]
pub fn restrict_to_x_only() -> Self
[src]

Allow rotation around the x axis only (and prevent rotating around the other axes)

#[must_use]
pub fn restrict_to_y_only() -> Self
[src]

Allow rotation around the y axis only (and prevent rotating around the other axes)

#[must_use]
pub fn restrict_to_z_only() -> Self
[src]

Allow rotation around the z axis only (and prevent rotating around the other axes)

Trait Implementations

impl Clone for RotationConstraints[src]

impl Copy for RotationConstraints[src]

impl Debug for RotationConstraints[src]

impl Default for RotationConstraints[src]

impl GetTypeRegistration for RotationConstraints[src]

impl Reflect for RotationConstraints[src]

impl Struct for RotationConstraints[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> DowncastSync for T where
    T: Any + Send + Sync

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

impl<T> FromWorld for T where
    T: Default

impl<S> GetField for S where
    S: Struct, 

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