Trait physx::rigid_dynamic::RigidDynamic
source · [−]pub trait RigidDynamic: Class<PxRigidDynamic> + RigidBody + UserData {
Show 22 methods
fn new(
physics: &mut impl Physics,
transform: PxTransform,
geometry: &impl Geometry,
material: &mut <Self::Shape as Shape>::Material,
density: f32,
shape_transform: PxTransform,
user_data: Self::UserData
) -> Option<Owner<Self>> { ... }
unsafe fn from_raw(
ptr: *mut PxRigidDynamic,
user_data: Self::UserData
) -> Option<Owner<Self>> { ... }
fn get_user_data(&self) -> &Self::UserData { ... }
fn get_user_data_mut(&mut self) -> &mut Self::UserData { ... }
fn get_contact_report_threshold(&self) -> f32 { ... }
fn get_kinematic_target(&self) -> Option<PxTransform> { ... }
fn get_rigid_dynamic_lock_flags(&self) -> RigidDynamicLockFlags { ... }
fn get_sleep_threshold(&self) -> f32 { ... }
fn get_solver_iteration_counts(&self) -> (u32, u32) { ... }
fn get_stabilization_threshold(&self) -> f32 { ... }
fn get_wake_counter(&self) -> f32 { ... }
fn is_sleeping(&self) -> bool { ... }
fn put_to_sleep(&mut self) { ... }
fn set_contact_report_threshold(&mut self, threshold: f32) { ... }
fn set_kinematic_target(&mut self, target: &PxTransform) { ... }
fn set_rigid_dynamic_lock_flag(
&mut self,
flag: RigidDynamicLockFlag,
value: bool
) { ... }
fn set_rigid_dynamic_lock_flags(&mut self, flags: RigidDynamicLockFlags) { ... }
fn set_sleep_threshold(&mut self, threshold: f32) { ... }
fn set_solver_iteration_counts(
&mut self,
min_position_iterations: u32,
min_velocity_iterations: u32
) { ... }
fn set_stabilization_threshold(&mut self, threshold: f32) { ... }
fn set_wake_counter(&mut self, wake_counter: f32) { ... }
fn wake_up(&mut self) { ... }
}
Provided Methods
sourcefn new(
physics: &mut impl Physics,
transform: PxTransform,
geometry: &impl Geometry,
material: &mut <Self::Shape as Shape>::Material,
density: f32,
shape_transform: PxTransform,
user_data: Self::UserData
) -> Option<Owner<Self>>
fn new(
physics: &mut impl Physics,
transform: PxTransform,
geometry: &impl Geometry,
material: &mut <Self::Shape as Shape>::Material,
density: f32,
shape_transform: PxTransform,
user_data: Self::UserData
) -> Option<Owner<Self>>
Create a new RigidDynamic.
sourceunsafe fn from_raw(
ptr: *mut PxRigidDynamic,
user_data: Self::UserData
) -> Option<Owner<Self>>
unsafe fn from_raw(
ptr: *mut PxRigidDynamic,
user_data: Self::UserData
) -> Option<Owner<Self>>
Create a new Owner wrapper around a raw pointer.
Safety
Owner’s own the pointer they wrap, using the pointer after dropping the Owner,
or creating multiple Owners from the same pointer will cause UB. Use into_ptr
to
retrieve the pointer and consume the Owner without dropping the pointee.
Initializes user data.
sourcefn get_user_data(&self) -> &Self::UserData
fn get_user_data(&self) -> &Self::UserData
Get the user data.
sourcefn get_user_data_mut(&mut self) -> &mut Self::UserData
fn get_user_data_mut(&mut self) -> &mut Self::UserData
Get the user data.
sourcefn get_contact_report_threshold(&self) -> f32
fn get_contact_report_threshold(&self) -> f32
Get the contact report threshold. If the force between two actors exceeds this threshold for either actor, a contact report will be generated in accordance with the filter shader.
sourcefn get_kinematic_target(&self) -> Option<PxTransform>
fn get_kinematic_target(&self) -> Option<PxTransform>
Returns a copy of the target transform if the actor is knematically controlled and has a target set, otherwise it returns None.
sourcefn get_rigid_dynamic_lock_flags(&self) -> RigidDynamicLockFlags
fn get_rigid_dynamic_lock_flags(&self) -> RigidDynamicLockFlags
Get the lock flags.
sourcefn get_sleep_threshold(&self) -> f32
fn get_sleep_threshold(&self) -> f32
Get the sleep threshold. If the actor’s mass-normalized kinetic energy is below this value, the actor might go to sleep.
sourcefn get_solver_iteration_counts(&self) -> (u32, u32)
fn get_solver_iteration_counts(&self) -> (u32, u32)
Get the number of (position, velocity) iterations done by the solver.
sourcefn get_stabilization_threshold(&self) -> f32
fn get_stabilization_threshold(&self) -> f32
Get the stabilization threshold. Actors with mass-normalized kinetic energy may participate in stabilization.
sourcefn get_wake_counter(&self) -> f32
fn get_wake_counter(&self) -> f32
Get the wake counter.
sourcefn is_sleeping(&self) -> bool
fn is_sleeping(&self) -> bool
Returns true if the actor is sleeping. Sleeping actors are not simulated. If an actor is sleeping, it’s linear and angular velocities are zero, no force or torque updates are pending, and the wake counter is zero.
sourcefn put_to_sleep(&mut self)
fn put_to_sleep(&mut self)
Put the actor to sleep. Pending force and torque is cleared, and the wake counter and linear and angular velocities are all set to zero.
sourcefn set_contact_report_threshold(&mut self, threshold: f32)
fn set_contact_report_threshold(&mut self, threshold: f32)
Set the contact report threshold, used when determining if a contact report should be generated.
sourcefn set_kinematic_target(&mut self, target: &PxTransform)
fn set_kinematic_target(&mut self, target: &PxTransform)
Set the kinematic target of the actor. Set an actor as kinematic using RigidBodyFlag::Kinematic
.
The actor will have it’s velocity set such that it gets moved to the desired pose in a single timestep,
then the velocity will be zeroed. Movement along a path requires continuous calls. Consecutive calls
in a single frame will overwrite the prior.
sourcefn set_rigid_dynamic_lock_flag(&mut self, flag: RigidDynamicLockFlag, value: bool)
fn set_rigid_dynamic_lock_flag(&mut self, flag: RigidDynamicLockFlag, value: bool)
Set a lock flag, preventing movement along or about an axis.
sourcefn set_rigid_dynamic_lock_flags(&mut self, flags: RigidDynamicLockFlags)
fn set_rigid_dynamic_lock_flags(&mut self, flags: RigidDynamicLockFlags)
Set the lock flags.
sourcefn set_sleep_threshold(&mut self, threshold: f32)
fn set_sleep_threshold(&mut self, threshold: f32)
Set the mass normalized kinetic energy under which an actor is a candidate for being slept. Default is 5e-5f * PxTolerancesScale.speed ^ 2. Value is clamped to range [0.0 .. ].
sourcefn set_solver_iteration_counts(
&mut self,
min_position_iterations: u32,
min_velocity_iterations: u32
)
fn set_solver_iteration_counts(
&mut self,
min_position_iterations: u32,
min_velocity_iterations: u32
)
Set the number of solver iterations for the position and velocity solvers clamped to range [1..=255]. Defualt is position = 4 and velocity = 1. If bodies are oscillating, increase the position iterations. If bodies are being depenetrated too quickly, increase the velocity iterations.
sourcefn set_stabilization_threshold(&mut self, threshold: f32)
fn set_stabilization_threshold(&mut self, threshold: f32)
Set the stabilization threshold. Actors with mass-normalized kinetic energy above this value will not participate in stabilization.
sourcefn set_wake_counter(&mut self, wake_counter: f32)
fn set_wake_counter(&mut self, wake_counter: f32)
Sets the wake counter. This is the minimum amount of time until an actor must spend below the sleep threshold before it is put to sleep. Setting this to a positive value will wake the actor. Default is 0.4, value is in seconds.