pub struct RigidBody {Show 14 fields
pub position: [f32; 3],
pub velocity: [f32; 3],
pub rotation: [f32; 4],
pub angular_velocity: [f32; 3],
pub mass: f32,
pub inv_mass: f32,
pub restitution: f32,
pub friction: f32,
pub shape: CollisionShape,
pub is_static: bool,
pub is_active: bool,
pub sleep_frames: u16,
pub is_sleeping: bool,
pub cosmetic_only: bool,
}Expand description
Rigid body state.
Fields§
§position: [f32; 3]§velocity: [f32; 3]§rotation: [f32; 4]§angular_velocity: [f32; 3]§mass: f32§inv_mass: f32§restitution: f32§friction: f32§shape: CollisionShape§is_static: bool§is_active: bool§sleep_frames: u16§is_sleeping: bool§cosmetic_only: boolCosmetic-only body: collisions are skipped when Superposed. Gameplay-critical bodies (NPCs, triggers, quest objects) must leave this false. Cosmetic bodies (crates, barrels, debris, foliage) can set this true for observer-dependent collision skip — the body is physically correct when Active but not resolved when no observer is watching.
Implementations§
Source§impl RigidBody
impl RigidBody
Sourcepub fn dynamic(mass: f32, shape: CollisionShape) -> Self
pub fn dynamic(mass: f32, shape: CollisionShape) -> Self
Create a dynamic body with the given mass and shape.
Sourcepub fn fixed(shape: CollisionShape) -> Self
pub fn fixed(shape: CollisionShape) -> Self
Create a static (immovable) body.
Sourcepub fn as_cosmetic(self) -> Self
pub fn as_cosmetic(self) -> Self
Mark this body as cosmetic-only. When Superposed, its collisions are skipped. Use for debris, crates, barrels, foliage — anything not gameplay-critical.
pub fn with_position(self, pos: [f32; 3]) -> Self
pub fn with_restitution(self, e: f32) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RigidBody
impl RefUnwindSafe for RigidBody
impl Send for RigidBody
impl Sync for RigidBody
impl Unpin for RigidBody
impl UnsafeUnpin for RigidBody
impl UnwindSafe for RigidBody
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
Mutably borrows from an owned value. Read more