pub struct PhysicsWorld {Show 14 fields
pub gravity: Vector3<f32>,
pub rigid_body_set: RigidBodySet,
pub collider_set: ColliderSet,
pub integration_parameters: IntegrationParameters,
pub island_manager: IslandManager,
pub broad_phase: BroadPhase,
pub narrow_phase: NarrowPhase,
pub impulse_joint_set: ImpulseJointSet,
pub multibody_joint_set: MultibodyJointSet,
pub ccd_solver: CCDSolver,
pub query_pipeline: QueryPipeline,
pub named_rigid_bodies: NamedHandleMap<RigidBodyHandle>,
pub named_sensors: NamedHandleMap<ColliderHandle>,
pub pipeline: PhysicsPipeline,
/* private fields */
}Expand description
The physics management structure. This is a thin wrapper around the Rapier physics engine with additional utilities.
Fields§
§gravity: Vector3<f32>§rigid_body_set: RigidBodySet§collider_set: ColliderSet§integration_parameters: IntegrationParameters§island_manager: IslandManager§broad_phase: BroadPhase§narrow_phase: NarrowPhase§impulse_joint_set: ImpulseJointSet§multibody_joint_set: MultibodyJointSet§ccd_solver: CCDSolver§query_pipeline: QueryPipeline§named_rigid_bodies: NamedHandleMap<RigidBodyHandle>§named_sensors: NamedHandleMap<ColliderHandle>§pipeline: PhysicsPipelineImplementations§
Source§impl PhysicsWorld
impl PhysicsWorld
Sourcepub fn remove_body(&mut self, body_handle: RigidBodyHandle) -> Option<RigidBody>
pub fn remove_body(&mut self, body_handle: RigidBodyHandle) -> Option<RigidBody>
Remove a RigidBody from the physics world using its handle.
Sourcepub fn load_from_gltf(
&mut self,
gltf: &Gltf,
parent_transform: Option<Transform3<f32>>,
) -> Result<(), PhysicsWorldInitError>
pub fn load_from_gltf( &mut self, gltf: &Gltf, parent_transform: Option<Transform3<f32>>, ) -> Result<(), PhysicsWorldInitError>
Load physics-enabled objects from a Perigee-enabled glTF into the physics world.
Note: Nodes that are children of others will be ignored.
pub fn listen_to_collider<L: ColliderEventListener + 'static>( &mut self, handle: ColliderHandle, listener: L, )
pub fn rekey_listeners( &mut self, old_handle: ColliderHandle, new_handle: ColliderHandle, )
Sourcepub fn step(&mut self, delta_seconds: f32)
pub fn step(&mut self, delta_seconds: f32)
Step the physics simulation by the provided number of seconds.
Sourcepub unsafe fn get_body_handle(body: &RigidBody) -> RigidBodyHandle
pub unsafe fn get_body_handle(body: &RigidBody) -> RigidBodyHandle
Recover the handle from a RigidBody using its user_data field.
Sourcepub unsafe fn store_handle_in_body(
handle: &RigidBodyHandle,
body: &mut RigidBody,
)
pub unsafe fn store_handle_in_body( handle: &RigidBodyHandle, body: &mut RigidBody, )
Store the parts of the RigidBody’s handle in its user_data field.
Trait Implementations§
Source§impl Default for PhysicsWorld
impl Default for PhysicsWorld
Source§impl<'de> Deserialize<'de> for PhysicsWorld
impl<'de> Deserialize<'de> for PhysicsWorld
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl FromConfig for PhysicsWorld
impl FromConfig for PhysicsWorld
type Config<'a> = &'a PhysicsConfig
fn from_config<'a>(config: Self::Config<'a>) -> Self
fn set_config<'a>(&mut self, _config: Self::Config<'a>)
Auto Trait Implementations§
impl Freeze for PhysicsWorld
impl !RefUnwindSafe for PhysicsWorld
impl !Send for PhysicsWorld
impl !Sync for PhysicsWorld
impl Unpin for PhysicsWorld
impl !UnwindSafe for PhysicsWorld
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’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>
Converts
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>
Converts
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<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.