Struct RigidBody3D
#[repr(C)]pub struct RigidBody3D {Show 14 fields
pub body_type: RigidBodyType3D,
pub pose: Motor,
pub prev_pose: Motor,
pub linear_velocity: [f32; 3],
pub angular_velocity: [f32; 3],
pub inv_mass: f32,
pub inv_inertia_local: [f32; 3],
pub restitution: f32,
pub friction: f32,
pub external_force: [f32; 3],
pub external_torque: [f32; 3],
pub collider_shape: ColliderShape3D,
pub is_sleeping: bool,
pub sleep_timer: f32,
}Expand description
3D rigid body with PGA [Motor] pose and physical properties (HotZeroHeap).
Fields§
§body_type: RigidBodyType3D§pose: MotorCurrent world-space PGA [Motor] pose.
prev_pose: MotorPrevious substep world-space PGA [Motor] pose (for XPBD velocity update).
linear_velocity: [f32; 3]World-space linear velocity [vx, vy, vz] in m/s.
angular_velocity: [f32; 3]World-space angular velocity [wx, wy, wz] in rad/s.
inv_mass: f32Inverse mass $1 / m$ in $\text{kg}^{-1}$ (0.0 for Static / Kinematic).
inv_inertia_local: [f32; 3]Principal local inverse inertia diagonal $[I_{xx}^{-1}, I_{yy}^{-1}, I_{zz}^{-1}]$.
restitution: f32Coefficient of restitution $e \in [0.0, 1.0]$.
friction: f32Coefficient of Coulomb friction $\mu \in [0.0, 2.0]$.
external_force: [f32; 3]Accumulated external force [fx, fy, fz] (Newtons) cleared at the end of each step.
external_torque: [f32; 3]Accumulated external torque [tx, ty, tz] (N·m) cleared at the end of each step.
collider_shape: ColliderShape3DAssociated 3D collision shape.
is_sleeping: boolTrue if the body has fallen below the kinetic energy sleep threshold.
sleep_timer: f32Seconds spent below the sleep velocity threshold.
Implementations§
§impl RigidBody3D
impl RigidBody3D
pub fn new_dynamic(
pose: Motor,
mass_kg: f32,
collider_shape: ColliderShape3D,
) -> RigidBody3D
pub fn new_dynamic( pose: Motor, mass_kg: f32, collider_shape: ColliderShape3D, ) -> RigidBody3D
Creates a dynamic 3D rigid body with automatic box/sphere inertia estimation.
pub fn new_static(pose: Motor, collider_shape: ColliderShape3D) -> RigidBody3D
pub fn new_static(pose: Motor, collider_shape: ColliderShape3D) -> RigidBody3D
Creates a static immovable 3D collider body.
pub fn effective_inv_mass(&self) -> f32
pub fn effective_inv_mass(&self) -> f32
Effective inverse mass (0.0 if non-dynamic).
pub fn apply_linear_impulse(&mut self, impulse: [f32; 3])
pub fn apply_linear_impulse(&mut self, impulse: [f32; 3])
Applies an instantaneous world-space linear impulse $\mathbf{J}$ (N·s) at the center of mass.
pub fn apply_impulse_at_point(
&mut self,
impulse: [f32; 3],
world_point: [f32; 3],
)
pub fn apply_impulse_at_point( &mut self, impulse: [f32; 3], world_point: [f32; 3], )
Applies an instantaneous world-space impulse $\mathbf{J}$ at world_point, generating both
linear and angular velocity changes.
pub fn integrate_pose(&mut self, dt: f32)
pub fn integrate_pose(&mut self, dt: f32)
Integrates translation and angular velocity into the PGA [Motor] pose over dt.
pub fn translate_world(&mut self, delta: [f32; 3])
pub fn translate_world(&mut self, delta: [f32; 3])
Shifts the rigid body’s world position by delta using a PGA translation motor.
Trait Implementations§
§impl Clone for RigidBody3D
impl Clone for RigidBody3D
§fn clone(&self) -> RigidBody3D
fn clone(&self) -> RigidBody3D
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more