[−][src]Struct nphysics2d::world::World
The physics world.
Methods
impl<N: Real> World<N>
[src]
pub fn new() -> Self
[src]
Creates a new physics world with default parameters.
The ground body is automatically created and added to the world without any colliders attached.
pub fn prediction(&self) -> N
[src]
Prediction distance used internally for collision detection.
pub fn disable_performance_counters(&mut self)
[src]
Disable the perfomance counters that measure various times and statistics during a timestep.
pub fn enable_performance_counters(&mut self)
[src]
Enable the perfomance counters that measure various times and statistics during a timestep.
pub fn performance_counters(&self) -> &Counters
[src]
Retrieve the perfomance counters that measure various times and statistics during a timestep.
pub fn set_contact_model<C: ContactModel<N>>(&mut self, model: C)
[src]
Set the contact model for all contacts.
pub fn integration_parameters(&self) -> &IntegrationParameters<N>
[src]
Retrieve a reference to the parameters for the integration.
pub fn integration_parameters_mut(&mut self) -> &mut IntegrationParameters<N>
[src]
Retrieve a mutable reference to the parameters for the integration.
pub fn materials_coefficients_table(&self) -> &MaterialsCoefficientsTable<N>
[src]
Reference to the lookup table for friction and restitution coefficients.
pub fn materials_coefficients_table_mut(
&mut self
) -> &mut MaterialsCoefficientsTable<N>
[src]
&mut self
) -> &mut MaterialsCoefficientsTable<N>
Mutable reference to the lookup table for friction and restitution coefficients.
pub fn timestep(&self) -> N
[src]
Retrieve the timestep used for the integration.
pub fn set_timestep(&mut self, dt: N)
[src]
Sets the timestep used for the integration.
pub fn activate_body(&mut self, handle: BodyHandle)
[src]
Activate the given body.
pub fn add_constraint<C: JointConstraint<N>>(
&mut self,
constraint: C
) -> ConstraintHandle
[src]
&mut self,
constraint: C
) -> ConstraintHandle
Add a constraints to the physics world and retrieves its handle.
pub fn constraint(&self, handle: ConstraintHandle) -> &dyn JointConstraint<N>
[src]
Get a reference to the specified constraint.
pub fn constraint_mut(
&mut self,
handle: ConstraintHandle
) -> &mut dyn JointConstraint<N>
[src]
&mut self,
handle: ConstraintHandle
) -> &mut dyn JointConstraint<N>
Get a mutable reference to the specified constraint.
pub fn remove_constraint(
&mut self,
handle: ConstraintHandle
) -> Box<dyn JointConstraint<N>>
[src]
&mut self,
handle: ConstraintHandle
) -> Box<dyn JointConstraint<N>>
Remove the specified constraint from the world.
pub fn remove_colliders(&mut self, handles: &[ColliderHandle])
[src]
Remove the specified collider from the world.
pub fn add_force_generator<G: ForceGenerator<N>>(
&mut self,
force_generator: G
) -> ForceGeneratorHandle
[src]
&mut self,
force_generator: G
) -> ForceGeneratorHandle
Add a force generator to the world.
pub fn force_generator(
&self,
handle: ForceGeneratorHandle
) -> &dyn ForceGenerator<N>
[src]
&self,
handle: ForceGeneratorHandle
) -> &dyn ForceGenerator<N>
Retrieve a reference to the specified force generator.
pub fn force_generator_mut(
&mut self,
handle: ForceGeneratorHandle
) -> &mut dyn ForceGenerator<N>
[src]
&mut self,
handle: ForceGeneratorHandle
) -> &mut dyn ForceGenerator<N>
Retrieve a mutable reference to the specified force generator.
pub fn remove_force_generator(
&mut self,
handle: ForceGeneratorHandle
) -> Box<dyn ForceGenerator<N>>
[src]
&mut self,
handle: ForceGeneratorHandle
) -> Box<dyn ForceGenerator<N>>
Remove the specified force generator from the world.
pub fn set_gravity(&mut self, gravity: Vector<N>)
[src]
Set the gravity.
pub fn gravity(&self) -> &Vector<N>
[src]
The gravity applied to all dynamic bodies.
pub fn step(&mut self)
[src]
Execute one time step of the physics simulation.
pub fn remove_bodies(&mut self, handles: &[BodyHandle])
[src]
Remove the specified bodies.
pub fn add_body<B: BodyDesc<N>>(&mut self, desc: &B) -> &mut B::Body
[src]
Adds a body to the world.
pub fn body(&self, handle: BodyHandle) -> Option<&dyn Body<N>>
[src]
Get a reference to the specified body.
pub fn body_mut(&mut self, handle: BodyHandle) -> Option<&mut dyn Body<N>>
[src]
Get a mutable reference to the specified body.
pub fn multibody(&self, handle: BodyHandle) -> Option<&Multibody<N>>
[src]
Get a reference to the multibody containing the specified multibody link.
Returns None
if the handle does not correspond to a multibody link in this world.
pub fn multibody_mut(&mut self, handle: BodyHandle) -> Option<&mut Multibody<N>>
[src]
Get a mutable reference to the multibody containing the specified multibody link.
Returns None
if the handle does not correspond to a multibody link in this world.
pub fn rigid_body(&self, handle: BodyHandle) -> Option<&RigidBody<N>>
[src]
Get a reference to the specified rigid body.
Returns None
if the handle does not correspond to a rigid body in this world.
pub fn rigid_body_mut(
&mut self,
handle: BodyHandle
) -> Option<&mut RigidBody<N>>
[src]
&mut self,
handle: BodyHandle
) -> Option<&mut RigidBody<N>>
Get a mutable reference to the specified rigid body.
Returns None
if the handle does not correspond to a rigid body in this world.
pub fn collider_world(&self) -> &ColliderWorld<N>
[src]
Reference to the underlying collision world.
pub fn collider_world_mut(&mut self) -> &mut ColliderWorld<N>
[src]
Mutable reference to the underlying collision world.
pub fn collider(&self, handle: ColliderHandle) -> Option<&Collider<N>>
[src]
Get a reference to the specified collider.
Returns None
if the handle does not correspond to a collider in this world.
pub fn collider_mut(
&mut self,
handle: ColliderHandle
) -> Option<&mut Collider<N>>
[src]
&mut self,
handle: ColliderHandle
) -> Option<&mut Collider<N>>
Get a mutable reference to the specified collider.
Returns None
if the handle does not correspond to a collider in this world.
pub fn collider_body_handle(&self, handle: ColliderHandle) -> Option<BodyHandle>
[src]
Gets the handle of the body the specified collider is attached to.
pub fn collider_anchor(
&self,
handle: ColliderHandle
) -> Option<&ColliderAnchor<N>>
[src]
&self,
handle: ColliderHandle
) -> Option<&ColliderAnchor<N>>
Gets the anchor attaching this collider to a body or body part.
pub fn colliders(
&self
) -> impl Iterator<Item = &Collider<N>>
[src]
&self
) -> impl Iterator<Item = &Collider<N>>
An iterator through all the colliders on this collision world.
pub fn bodies(
&self
) -> impl Iterator<Item = &dyn Body<N>>
[src]
&self
) -> impl Iterator<Item = &dyn Body<N>>
An iterator through all the bodies on this world.
pub fn bodies_mut(
&mut self
) -> impl Iterator<Item = &mut dyn Body<N>>
[src]
&mut self
) -> impl Iterator<Item = &mut dyn Body<N>>
A mutable iterator through all the bodies on this world.
pub fn bodies_with_name<'a>(
&'a self,
name: &'a str
) -> impl Iterator<Item = &'a dyn Body<N>>
[src]
&'a self,
name: &'a str
) -> impl Iterator<Item = &'a dyn Body<N>>
An iterator through all the bodies with the given name.
pub fn bodies_with_name_mut<'a>(
&'a mut self,
name: &'a str
) -> impl Iterator<Item = &'a mut dyn Body<N>>
[src]
&'a mut self,
name: &'a str
) -> impl Iterator<Item = &'a mut dyn Body<N>>
An iterator through all the bodies with the given name.
pub fn contact_events(&self) -> &ContactEvents
[src]
An iterator through all the contact events generated during the last execution of self.step()
.
pub fn proximity_events(&self) -> &ProximityEvents
[src]
An iterator through all the proximity events generated during the last execution of self.step()
.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>
[src]
fn as_any(&self) -> &(dyn Any + 'static)
[src]
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<SS, SP> SupersetOf for SP where
SS: SubsetOf<SP>,
[src]
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
[src]
fn is_in_subset(&self) -> bool
[src]
unsafe fn to_subset_unchecked(&self) -> SS
[src]
fn from_subset(element: &SS) -> SP
[src]
impl<T> Same for T
type Output = T
Should always be Self