Struct nphysics2d::world::World [] [src]

pub struct World<N: Scalar> {
    // some fields omitted
}

The physical world.

This is the main structure of the physics engine.

Methods

impl<N: Scalar> World<N>
[src]

fn new() -> World<N>

Creates a new physics world.

fn step(&mut self, dt: N)

Updates the physics world.

fn add_rigid_body(&mut self, rb: RigidBody<N>) -> RigidBodyHandle<N>

Adds a rigid body to the physics world.

fn add_sensor(&mut self, sensor: Sensor<N>) -> SensorHandle<N>

Adds a sensor to the physics world.

fn remove_rigid_body(&mut self, rb: &RigidBodyHandle<N>)

Remove a rigid body from the physics world.

fn remove_sensor(&mut self, sensor: &SensorHandle<N>)

Remove a sensor from the physics world.

fn forces_generator(&mut self) -> &mut BodyForceGenerator<N>

Gets a mutable reference to the force generator.

fn integrator(&mut self) -> &mut BodySmpEulerIntegrator

Gets a mutable reference to the position and orientation integrator.

fn ccd_manager(&mut self) -> &mut TranslationalCCDMotionClamping<N>

Gets a mutable reference to the CCD manager.

fn joint_manager(&mut self) -> &mut JointManager<N>

Gets a mutable reference to the joint manager.

fn constraints_solver(&mut self) -> &mut AccumulatedImpulseSolver<N>

Gets a mutable reference to the constraint solver.

fn collision_world(&self) -> &RigidBodyCollisionWorld<N>

Gets the underlying collision world.

fn set_gravity(&mut self, gravity: Vector<N>)

Sets the linear acceleration afecting every dynamic rigid body.

fn gravity(&self) -> Vector<N>

Gets the linear acceleration afecting every dynamic rigid body.

fn add_ccd_to(&mut self, body: &RigidBodyHandle<N>, motion_thresold: N, trigger_sensors: bool)

Adds continuous collision detection to the given rigid body.

Set trigger_sensor to true if the rigid body should active the sensors that would have been missed without CCD enabled.

fn add_ball_in_socket(&mut self, joint: BallInSocket<N>) -> Rc<RefCell<BallInSocket<N>>>

Adds a ball-in-socket joint to the world.

fn remove_ball_in_socket(&mut self, joint: &Rc<RefCell<BallInSocket<N>>>)

Removes a ball-in-socket joint from the world.

fn add_fixed(&mut self, joint: Fixed<N>) -> Rc<RefCell<Fixed<N>>>

Adds a fixed joint to the world.

fn remove_fixed(&mut self, joint: &Rc<RefCell<Fixed<N>>>)

Removes a fixed joint from the world.

fn constraints(&mut self, out: &mut Vec<Constraint<N>>)

Collects every constraincts detected since the last update.

fn rigid_bodies(&self) -> RigidBodies<N>

An iterator visiting all rigid bodies on this world.

fn sensors(&self) -> Sensors<N>

An iterator visiting all sensors on this world.

fn register_broad_phase_pair_filter<F>(&mut self, name: &str, filter: F) where F: BroadPhasePairFilter<Point<N>, Matrix<N>, WorldObject<N>> + 'static

Adds a filter that tells if a potential collision pair should be ignored or not.

The proximity filter returns false for a given pair of collision objects if they should be ignored by the narrow phase. Keep in mind that modifying the proximity filter will have a non-trivial overhead during the next update as it will force re-detection of all collision pairs.

fn unregister_broad_phase_pair_filter(&mut self, name: &str)

Removes the pair filter named name.

fn register_contact_handler<H>(&mut self, name: &str, handler: H) where H: ContactHandler<Point<N>, Matrix<N>, WorldObject<N>> + 'static

Registers a handler for contact start/stop events.

fn unregister_contact_handler(&mut self, name: &str)

Unregisters a handler for contact start/stop events.

fn register_proximity_handler<H>(&mut self, name: &str, handler: H) where H: ProximityHandler<Point<N>, Matrix<N>, WorldObject<N>> + 'static

Registers a handler for proximity status change events.

fn unregister_proximity_handler(&mut self, name: &str)

Unregisters a handler for proximity status change events.