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 moreimpl Copy for RigidBody3D
§impl Debug for RigidBody3D
impl Debug for RigidBody3D
§impl Default for RigidBody3D
impl Default for RigidBody3D
§fn default() -> RigidBody3D
fn default() -> RigidBody3D
§impl PartialEq for RigidBody3D
impl PartialEq for RigidBody3D
impl StructuralPartialEq for RigidBody3D
Auto Trait Implementations§
impl Freeze for RigidBody3D
impl RefUnwindSafe for RigidBody3D
impl Send for RigidBody3D
impl Sync for RigidBody3D
impl Unpin for RigidBody3D
impl UnsafeUnpin for RigidBody3D
impl UnwindSafe for RigidBody3D
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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 more