Struct bevy_retrograde_physics::RotationConstraints [−]
Expand description
Component that restrict what rotations can be caused by forces.
It must be inserted on the same entity of a RigidBody
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(CollisionShape::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
impl RotationConstraints
pub fn lock() -> RotationConstraints
pub fn lock() -> RotationConstraints
Lock rotations around all axes
pub fn allow() -> RotationConstraints
pub fn allow() -> RotationConstraints
Allow rotations around all axes
pub fn restrict_to_x_only() -> RotationConstraints
pub fn restrict_to_x_only() -> RotationConstraints
Allow rotation around the x axis only (and prevent rotating around the other axes)
pub fn restrict_to_y_only() -> RotationConstraints
pub fn restrict_to_y_only() -> RotationConstraints
Allow rotation around the y axis only (and prevent rotating around the other axes)
pub fn restrict_to_z_only() -> RotationConstraints
pub fn restrict_to_z_only() -> RotationConstraints
Allow rotation around the z axis only (and prevent rotating around the other axes)
Trait Implementations
impl Clone for RotationConstraints
impl Clone for RotationConstraints
pub fn clone(&self) -> RotationConstraints
pub fn clone(&self) -> RotationConstraints
Returns a copy of the value. Read more
Performs copy-assignment from source
. Read more
impl Debug for RotationConstraints
impl Debug for RotationConstraints
impl Default for RotationConstraints
impl Default for RotationConstraints
pub fn default() -> RotationConstraints
pub fn default() -> RotationConstraints
Returns the “default value” for a type. Read more
impl GetTypeRegistration for RotationConstraints
impl GetTypeRegistration for RotationConstraints
pub fn get_type_registration() -> TypeRegistration
impl Reflect for RotationConstraints
impl Reflect for RotationConstraints
pub fn clone_value(&self) -> Box<dyn Reflect + 'static, Global>
pub fn set(
&mut self,
value: Box<dyn Reflect + 'static, Global>
) -> Result<(), Box<dyn Reflect + 'static, Global>>
pub fn apply(&mut self, value: &(dyn Reflect + 'static))
pub fn reflect_ref(&self) -> ReflectRef<'_>
pub fn reflect_mut(&mut self) -> ReflectMut<'_>
pub fn serializable(&self) -> Option<Serializable<'_>>
pub fn serializable(&self) -> Option<Serializable<'_>>
Returns a serializable value, if serialization is supported. Otherwise None
will be
returned. Read more
pub fn reflect_hash(&self) -> Option<u64>
pub fn reflect_hash(&self) -> Option<u64>
Returns a hash of the value (which includes the type) if hashing is supported. Otherwise
None
will be returned. Read more
pub fn reflect_partial_eq(
&self,
value: &(dyn Reflect + 'static)
) -> Option<bool>
pub fn reflect_partial_eq(
&self,
value: &(dyn Reflect + 'static)
) -> Option<bool>
Returns a “partial equal” comparison result if comparison is supported. Otherwise None
will be returned. Read more
impl Struct for RotationConstraints
impl Struct for RotationConstraints
pub fn field_at_mut(
&mut self,
index: usize
) -> Option<&mut (dyn Reflect + 'static)>
pub fn iter_fields(&self) -> FieldIter<'_>
pub fn clone_dynamic(&self) -> DynamicStruct
impl Copy for RotationConstraints
Auto Trait Implementations
impl RefUnwindSafe for RotationConstraints
impl Send for RotationConstraints
impl Sync for RotationConstraints
impl Unpin for RotationConstraints
impl UnwindSafe for RotationConstraints
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
impl<T> FromWorld for T where
T: Default,
impl<T> FromWorld for T where
T: Default,
pub fn from_world(_world: &mut World) -> T
pub fn from_world(_world: &mut World) -> T
Creates Self
using data from the given [World]
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
pub fn clone_type_data(&self) -> Box<dyn TypeData + 'static, Global>
pub fn vzip(self) -> V