pub type DefaultMechanicalWorld<N> = MechanicalWorld<N, Index, Index>;
Expand description

The default mechanical world, that can be used with a DefaultBodyHandle and DefaultColliderHandle.

Aliased Type§

struct DefaultMechanicalWorld<N> {
    pub counters: Counters,
    pub solver: MoreauJeanSolver<N, Index, Index>,
    pub integration_parameters: IntegrationParameters<N>,
    pub material_coefficients: MaterialsCoefficientsTable<N>,
    pub gravity: Matrix<N, Const<2>, Const<1>, ArrayStorage<N, 2, 1>>,
    /* private fields */
}

Fields§

§counters: Counters

Performance counters used for debugging and benchmarking nphysics.

§solver: MoreauJeanSolver<N, Index, Index>

The constraints solver.

§integration_parameters: IntegrationParameters<N>

Parameters of the whole simulation.

§material_coefficients: MaterialsCoefficientsTable<N>

Coefficient table used for resolving material properties to apply at one contact.

§gravity: Matrix<N, Const<2>, Const<1>, ArrayStorage<N, 2, 1>>

The acting on this mechanical world.

Implementations§

source§

impl<N, Handle, CollHandle> MechanicalWorld<N, Handle, CollHandle>where N: RealField + Copy, Handle: BodyHandle, CollHandle: ColliderHandle,

source

pub fn new( gravity: Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>> ) -> MechanicalWorld<N, Handle, CollHandle>

Creates a new physics world with default parameters.

The ground body is automatically created and added to the world without any colliders attached.

source

pub fn timestep(&self) -> N

Retrieve the timestep used for the integration.

source

pub fn set_timestep(&mut self, dt: N)

Sets the timestep used for the integration.

source

pub fn maintain<Colliders, Constraints>( &mut self, gworld: &mut GeometricalWorld<N, Handle, CollHandle>, bodies: &mut dyn BodySet<N, Handle = Handle>, colliders: &mut Colliders, constraints: &mut Constraints )where Colliders: ColliderSet<N, Handle, Handle = CollHandle>, Constraints: JointConstraintSet<N, Handle>,

Maintain the internal structures of the mechanical world by handling insersion and removal events from every sets this mechanical world interacts with.

source

pub fn step<Bodies, Colliders, Constraints, Forces>( &mut self, gworld: &mut GeometricalWorld<N, Handle, CollHandle>, bodies: &mut Bodies, colliders: &mut Colliders, constraints: &mut Constraints, forces: &mut Forces )where Bodies: BodySet<N, Handle = Handle>, Colliders: ColliderSet<N, Handle, Handle = CollHandle>, Constraints: JointConstraintSet<N, Handle>, Forces: ForceGeneratorSet<N, Handle>,

Execute one time step of the physics simulation.

source

pub fn step_with_filter<Bodies, Colliders, Constraints, Forces, Filter>( &mut self, gworld: &mut GeometricalWorld<N, Handle, CollHandle>, bodies: &mut Bodies, colliders: &mut Colliders, constraints: &mut Constraints, forces: &mut Forces, filter: &Filter )where Bodies: BodySet<N, Handle = Handle>, Colliders: ColliderSet<N, Handle, Handle = CollHandle>, Constraints: JointConstraintSet<N, Handle>, Forces: ForceGeneratorSet<N, Handle>, Filter: for<'a> BroadPhasePairFilter<N, BroadPhasePairFilterSets<'a, N, Bodies, Colliders>> + ?Sized,

Execute one time step of the physics simulation.