[][src]Struct nphysics3d::world::World

pub struct World<N: RealField> { /* fields omitted */ }

The physics world.

Methods

impl<N: RealField> 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]

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]

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]

Get a mutable reference to the specified constraint.

pub fn remove_constraint(
    &mut self,
    handle: ConstraintHandle
) -> Box<dyn JointConstraint<N>>
[src]

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]

Add a force generator to the world.

pub fn force_generator(
    &self,
    handle: ForceGeneratorHandle
) -> &dyn ForceGenerator<N>
[src]

Retrieve a reference to the specified force generator.

pub fn force_generator_mut(
    &mut self,
    handle: ForceGeneratorHandle
) -> &mut dyn ForceGenerator<N>
[src]

Retrieve a mutable reference to the specified force generator.

pub fn remove_force_generator(
    &mut self,
    handle: ForceGeneratorHandle
) -> Box<dyn ForceGenerator<N>>
[src]

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]

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]

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]

Gets the anchor attaching this collider to a body or body part.

pub fn colliders(&self) -> impl Iterator<Item = &Collider<N>>[src]

An iterator through all the colliders on this collision world.

pub fn bodies(&self) -> impl Iterator<Item = &dyn Body<N>>[src]

An iterator through all the bodies on this world.

pub fn bodies_mut(&mut self) -> impl Iterator<Item = &mut dyn Body<N>>[src]

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]

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]

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

impl<N: RealField> Default for World<N>[src]

Auto Trait Implementations

impl<N> Send for World<N> where
    N: Scalar

impl<N> Sync for World<N> where
    N: Scalar

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Downcast for T where
    T: Any
[src]

impl<SS, SP> SupersetOf for SP where
    SS: SubsetOf<SP>, 
[src]

impl<T> Same for T

type Output = T

Should always be Self