pub struct World<S: PhysicsSpace> {
pub narrowphase: Narrowphase<S>,
pub field_narrowphase: FieldNarrowphase<S>,
/* private fields */
}Fields§
§narrowphase: Narrowphase<S>§field_narrowphase: FieldNarrowphase<S>Implementations§
Source§impl<S: PhysicsSpace> World<S>
impl<S: PhysicsSpace> World<S>
pub fn new(space: S) -> Self
Sourcepub fn counters(&self) -> StepCounters
pub fn counters(&self) -> StepCounters
From the last step or broadphase_into.
pub fn bodies(&self) -> &BodyArena<S>
pub fn space(&self) -> &S
pub fn gravity(&self) -> Option<S::Vector>
pub fn set_gravity( &mut self, gravity: Option<S::Vector>, ) -> Result<(), EditError>
pub fn solver_iterations(&self) -> usize
pub fn set_solver_iterations(&mut self, iterations: usize)
pub fn solver_tolerance(&self) -> f32
pub fn set_solver_tolerance(&mut self, tolerance: f32) -> Result<(), EditError>
pub fn time(&self) -> f32
pub fn body(&self, id: BodyId) -> Option<&RigidBody<S>>
pub fn manifolds( &self, ) -> impl ExactSizeIterator<Item = (&PairKey, &Manifold<S>)>
pub fn manifold(&self, key: PairKey) -> Option<&Manifold<S>>
pub fn solve_report(&self) -> SolveReport
pub fn push_body(&mut self, body: BodyDef<S>) -> BodyId
Sourcepub fn insert_field(
&mut self,
anchor: BodyId,
field: Box<dyn DistanceField>,
) -> Result<FieldId, EditError>
pub fn insert_field( &mut self, anchor: BodyId, field: Box<dyn DistanceField>, ) -> Result<FieldId, EditError>
anchor must be static; it leaves every collision group so the broadphase never pairs it, and it owns the field’s contacts.
Sourcepub fn bind_field(
&mut self,
body: BodyId,
field: FieldId,
) -> Result<(), EditError>
pub fn bind_field( &mut self, body: BodyId, field: FieldId, ) -> Result<(), EditError>
Every step queries the field for body; a contact lands in the manifold keyed by the body and the field’s anchor.
pub fn field_bindings(&self) -> &[(BodyId, FieldId)]
pub fn geometry(&self) -> &GeometryStore
Sourcepub fn reclaim_geometry(&mut self) -> Option<Collider>
pub fn reclaim_geometry(&mut self) -> Option<Collider>
Pops the newest of the last two released shapes so its buffer can be reused.
pub fn collider(&self, body: &RigidBody<S>) -> Option<&Collider>
Sourcepub fn despawn_body(&mut self, id: BodyId) -> Result<(), EditError>
pub fn despawn_body(&mut self, id: BodyId) -> Result<(), EditError>
Also removes every manifold the body takes part in.
Sourcepub fn set_pose(
&mut self,
id: BodyId,
position: S::Point,
orientation: S::Iso,
) -> Result<(), EditError>
pub fn set_pose( &mut self, id: BodyId, position: S::Point, orientation: S::Iso, ) -> Result<(), EditError>
Drops the body’s contacts.
pub fn set_velocity( &mut self, id: BodyId, velocity: S::Vector, angular_velocity: S::AngVel, ) -> Result<(), EditError>
pub fn set_restitution( &mut self, id: BodyId, restitution: f32, ) -> Result<(), EditError>
pub fn set_collision_filter( &mut self, id: BodyId, group: u32, mask: u32, ) -> Result<(), EditError>
Sourcepub fn set_mass_properties(
&mut self,
id: BodyId,
mass: f32,
inertia: S::Inertia,
) -> Result<(), EditError>
pub fn set_mass_properties( &mut self, id: BodyId, mass: f32, inertia: S::Inertia, ) -> Result<(), EditError>
Drops the body’s contacts.
Sourcepub fn set_collider(
&mut self,
id: BodyId,
collider: Collider,
inertia: S::Inertia,
) -> Result<(), EditError>
pub fn set_collider( &mut self, id: BodyId, collider: Collider, inertia: S::Inertia, ) -> Result<(), EditError>
Drops the body’s contacts.
pub fn apply_impulse( &mut self, id: BodyId, impulse: S::Vector, ) -> Result<(), EditError>
pub fn apply_impulse_at_point( &mut self, id: BodyId, impulse: S::Vector, point: S::Point, ) -> Result<(), EditError>
pub fn sleep_body(&mut self, id: BodyId) -> Result<(), EditError>
pub fn wake_body(&mut self, id: BodyId) -> Result<(), EditError>
Sourcepub fn drain_dirty(&mut self) -> DirtyDrain<'_, S> ⓘ
pub fn drain_dirty(&mut self) -> DirtyDrain<'_, S> ⓘ
Yields each body spawned, integrated, edited, or restored since the last drain, skipping despawned ones.
pub fn snapshot(&self) -> WorldState<S>
pub fn check_restore(&self, state: &WorldState<S>) -> Result<(), EditError>
Sourcepub fn restore(&mut self, state: &WorldState<S>) -> Result<(), EditError>
pub fn restore(&mut self, state: &WorldState<S>) -> Result<(), EditError>
Refuses, unchanged, whatever check_restore refuses.
Sourcepub fn broadphase_into(&mut self, pairs: &mut Vec<PairKey>)
pub fn broadphase_into(&mut self, pairs: &mut Vec<PairKey>)
Replaces pairs with the sorted candidates: bounding-ball overlaps under a certified bound, every masked non-static pair otherwise.
Sourcepub fn hash_contacts(&self, hash: &mut StateHash)
pub fn hash_contacts(&self, hash: &mut StateHash)
Hashes contact keys, point counts, and normal impulses in key order.
Sourcepub fn state_hash(
&self,
sample_body: impl Fn(&RigidBody<S>, &mut Vec<u32>),
) -> u64
pub fn state_hash( &self, sample_body: impl Fn(&RigidBody<S>, &mut Vec<u32>), ) -> u64
Hashes bodies by handle, then contacts; sample_body must emit fixed-width records.
Sourcepub fn islands(&self) -> Vec<Island>
pub fn islands(&self) -> Vec<Island>
Returns islands by id; stale manifold handles panic after a bare BodyArena::despawn.