#[repr(u8)]pub enum RigidBodyType {
Dynamic = 0,
Kinematic = 1,
Static = 2,
}Expand description
Defines the physics behavior of a rigid body.
Different body types interact with the physics system in different ways. This determines whether the body is affected by forces, can be moved by the simulation, and how it collides with other bodies.
§FFI Safety
#[repr(u8)] ensures this enum has a stable ABI for FFI.
Variants§
Dynamic = 0
Dynamic bodies are fully simulated by the physics engine.
- Affected by gravity and forces
- Responds to collisions
- Can be moved by constraints
- Most expensive to simulate
Use for: players, enemies, projectiles, movable objects
Kinematic = 1
Kinematic bodies move via velocity but are not affected by forces.
- NOT affected by gravity or forces
- Does NOT respond to collisions (but affects other bodies)
- Moved by setting velocity or position directly
- Cheaper than dynamic
Use for: moving platforms, elevators, doors, cutscene objects
Static = 2
Static bodies do not move and are not affected by forces.
- Immovable
- NOT affected by gravity or forces
- Acts as obstacles for other bodies
- Cheapest to simulate (often excluded from updates)
Use for: walls, floors, terrain, static obstacles
Implementations§
Source§impl RigidBodyType
impl RigidBodyType
Sourcepub fn is_affected_by_gravity(self) -> bool
pub fn is_affected_by_gravity(self) -> bool
Returns true if this body type is affected by gravity.
Sourcepub fn is_affected_by_forces(self) -> bool
pub fn is_affected_by_forces(self) -> bool
Returns true if this body type is affected by forces and impulses.
Sourcepub fn responds_to_collisions(self) -> bool
pub fn responds_to_collisions(self) -> bool
Returns true if this body type responds to collisions.
Trait Implementations§
Source§impl Clone for RigidBodyType
impl Clone for RigidBodyType
Source§fn clone(&self) -> RigidBodyType
fn clone(&self) -> RigidBodyType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RigidBodyType
impl Debug for RigidBodyType
Source§impl Default for RigidBodyType
impl Default for RigidBodyType
Source§fn default() -> RigidBodyType
fn default() -> RigidBodyType
Defaults to Dynamic for most common use case.
Source§impl<'de> Deserialize<'de> for RigidBodyType
impl<'de> Deserialize<'de> for RigidBodyType
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RigidBodyType, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RigidBodyType, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for RigidBodyType
impl Display for RigidBodyType
Source§impl Hash for RigidBodyType
impl Hash for RigidBodyType
Source§impl PartialEq for RigidBodyType
impl PartialEq for RigidBodyType
Source§impl Serialize for RigidBodyType
impl Serialize for RigidBodyType
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for RigidBodyType
impl Eq for RigidBodyType
impl StructuralPartialEq for RigidBodyType
Auto Trait Implementations§
impl Freeze for RigidBodyType
impl RefUnwindSafe for RigidBodyType
impl Send for RigidBodyType
impl Sync for RigidBodyType
impl Unpin for RigidBodyType
impl UnsafeUnpin for RigidBodyType
impl UnwindSafe for RigidBodyType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().