# Struct nphysics3d::joint::UniversalConstraint[−][src]

`pub struct UniversalConstraint<N: Real> { /* fields omitted */ }`

A constraint that removes all but two relative rotations along distinct axii.

## Methods

### `impl<N: Real> UniversalConstraint<N>`[src]

#### `pub fn new(    b1: BodyHandle,     b2: BodyHandle,     anchor1: Point<N>,     axis1: Unit<AngularVector<N>>,     anchor2: Point<N>,     axis2: Unit<AngularVector<N>>,     angle: N) -> Self`[src]

Create a new universal constraint that ensure the angle between `axis1` and `axis2` is always equal to `angle`.

All anchors and axii are expressed in the local coordinate systems of the corresponding body parts.

## Trait Implementations

### `impl<N: Real> JointConstraint<N> for UniversalConstraint<N>`[src]

#### `fn num_velocity_constraints(&self) -> usize`[src]

The maximum number of velocity constraints generated by this joint.

#### `fn anchors(&self) -> (BodyHandle, BodyHandle)`[src]

The two body parts affected by this joint.

#### `fn velocity_constraints(    &mut self,     _: &IntegrationParameters<N>,     bodies: &BodySet<N>,     ext_vels: &DVector<N>,     ground_j_id: &mut usize,     j_id: &mut usize,     jacobians: &mut [N],     constraints: &mut ConstraintSet<N>)`[src]

Initialize and retrieve all the constraints appied to the bodies attached to this joint.

#### `fn cache_impulses(&mut self, constraints: &ConstraintSet<N>)`[src]

Called after velocity constraint resolution, allows the joint to keep a cache of impulses generated for each constraint.

#### `fn is_active(&self, bodies: &BodySet<N>) -> bool`[src]

Return `true` if the constraint is active. Read more

### `impl<N: Real> NonlinearConstraintGenerator<N> for UniversalConstraint<N>`[src]

#### `fn num_position_constraints(&self, bodies: &BodySet<N>) -> usize`[src]

Maximum of non-linear position constraint this generater needs to output.

#### `fn position_constraint(    &self,     params: &IntegrationParameters<N>,     i: usize,     bodies: &mut BodySet<N>,     jacobians: &mut [N]) -> Option<GenericNonlinearConstraint<N>>`[src]

Generate the `i`-th position constraint of this generator.