Constraints

Base Constraint

struct nvConstraint

Base two-body constraint.

Public Members

nvConstraintType type

Type of the constraint.

void *def

Constraint definition class. (This needs to be casted)

nvRigidBody *a

First body.

nvRigidBody *b

Second body.

nv_bool ignore_collision

Ignore collision of bodies connected with this constraint.

enum nvConstraintType

Constraint types.

Contact constraint is not included because it’s handled internally by the engine.

Values:

enumerator nvConstraintType_DISTANCE

Distance constraint type. See nvDistanceConstraint.

enumerator nvConstraintType_HINGE

Hinge constraint type. See nvHingeConstraint.

enumerator nvConstraintType_SPLINE

Spline constraint type. See nvSplineConstraint.

void nvConstraint_free(nvConstraint *cons)

Free constraint.

It’s safe to pass NULL to this function.

Parameters:

cons – Constraint

Coefficient Mixing

enum nvCoefficientMix

Coefficient mixing type is the method to mix various coefficients values like restitution and friction.

Values:

enumerator nvCoefficientMix_AVG

(a + b) * 0.5

enumerator nvCoefficientMix_MUL

a * b

enumerator nvCoefficientMix_SQRT

sqrt(a * b)

enumerator nvCoefficientMix_MIN

min(a, b)

enumerator nvCoefficientMix_MAX

max(a, b)

Contact Position Correction

enum nvContactPositionCorrection

Type of algorithm used to solve position error in collisions.

In baumgarte stabilization, the position error is fed back into the velocity constraint, this is an efficient solution however it adds energy to the system.

NGS (Non-Linear Gauss-Seidel) uses pseudo-velocities to resolve the drift. It is computationally bit more expensive but more stable. It is what version 2 of Box2D uses.

Note

Changing this setting should be usually avoided unless you have a specific need or familiar with the behavior.

Warning

Nova, as of 1.0.0, doesn’t have NGS solver yet.

Values:

enumerator nvContactPositionCorrection_BAUMGARTE

Baumgarte stabilization.

enumerator nvContactPositionCorrection_NGS

Non-Linear Gauss-Seidel.