PhysicsWorld

Struct PhysicsWorld 

Source
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: PhysicsPipeline

Implementations§

Source§

impl PhysicsWorld

Source

pub fn remove_body(&mut self, body_handle: RigidBodyHandle) -> Option<RigidBody>

Remove a RigidBody from the physics world using its handle.

Source

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.

Source

pub fn listen_to_collider<L: ColliderEventListener + 'static>( &mut self, handle: ColliderHandle, listener: L, )

Source

pub fn rekey_listeners( &mut self, old_handle: ColliderHandle, new_handle: ColliderHandle, )

Source

pub fn step(&mut self, delta_seconds: f32)

Step the physics simulation by the provided number of seconds.

Source

pub unsafe fn get_body_handle(body: &RigidBody) -> RigidBodyHandle

Recover the handle from a RigidBody using its user_data field.

Source

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

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for PhysicsWorld

Source§

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

Source§

type Config<'a> = &'a PhysicsConfig

Source§

fn from_config<'a>(config: Self::Config<'a>) -> Self

Source§

fn set_config<'a>(&mut self, _config: Self::Config<'a>)

Source§

impl Serialize for PhysicsWorld

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

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>

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)

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)

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,