Back to main page

Constraints

Constraints are connected to one or two rigid bodies and apply forces during simulation to softly enforce conditions to the position and velocity.

A finer timestep will be better at enforcing these constraints.

int Constraint_Create_PointToPoint_1(int RigidBody,float Point_X,float Point_Y,float Point_Z);

The object space position (Point_X, Point_Y, Point_Z) on RigidBody will be located at the same world space location as it had when the constraint was created.

RigidBody is a valid rigid body.

Returns the ID to the new constraint.

int Constraint_Create_PointToPoint_2(int RigidBodyA,int RigidBodyB,float PointA_X,float PointA_Y,float PointA_Z,float PointB_X,float PointB_Y,float PointB_Z);

The object space position (PointA_X, PointA_Y, PointA_Z) on RigidBodyA is aligned to the object space position (PointB_X, PointB_Y, PointB_Z) on RigidBodyB.

RigidBodyA and RigidBodyB are a valid rigid bodies.

Returns the ID to the new constraint.

int Constraint_Create_Hinge_1(int RigidBody,float Pivot_X,float Pivot_Y,float Pivot_Z,float Axis_X,float Axis_Y,float Axis_Z);

The object space position (Pivot_X, Pivot_Y, Pivot_Z) on RigidBody will be located at the same world space location as it had when the constraint was created.

RigidBody can only rotate around (Axis_X, Axis_Y, Axis_Z).

RigidBody is a valid rigid body.

Returns the ID to the new constraint.

int Constraint_Create_Hinge_2(int RigidBodyA,int RigidBodyB,float PivotA_X,float PivotA_Y,float PivotA_Z,float PivotB_X,float PivotB_Y,float PivotB_Z,float AxisA_X,float AxisA_Y,float AxisA_Z,float AxisB_X,float AxisB_Y,float AxisB_Z);

The object space position (PivotA_X, PivotA_Y, PivotA_Z) on RigidBodyA is aligned to the object space position (PivotB_X, PivotB_Y, PivotB_Z) on RigidBodyB.

The RigidBodyA and RigidBodyB will be rotated so that (AxisA_X, AxisA_Y, AxisA_Z) on RigidBodyA and (AxisB_X, AxisB_Y, AxisB_Z) have the same direction in world space.

RigidBodyA and RigidBodyB are a valid rigid bodies.

Returns the ID to the new constraint.

void Constraint_Delete(int Constraint);

Constraint is a valid constraint.

Removes Constraint.

void Constraint_SetEnabled(int Constraint, bool Enabled);

New constraints are enabled by default.

Constraint is a valid constraint.

If Enabled is true then Constraint is enabled. If Enabled is false then Constraint is not used during simulation.

int Constraint_GetEnabled(int Constraint);

Constraint is a valid constraint.

Returns 1 if Constraint is enabled and 0 if Constraint is disabled.

void Constraint_Hinge_Motor_Enable(int Constraint, bool Enabled);

The engine is disabled by default.

Activating the engine does nothing until a target velocity and maximum impulse has been set using Constraint_Hinge_Motor_Control.

This method is useful when you just want to turn the engine on and off without having to store the target velocity and maximum impulse.

Constraint is a valid hinge constraint.

If Enabled is true then Constraint's engine is activated. If Enabled is false then Constraint's engine is not applying any torque.

int Constraint_Hinge_Motor_IsEnabled(int Constraint);

Constraint is a valid hinge constraint.

Returns 1 if Constraint's engine is enabled and 0 if Constraint's engine is disabled.

void Constraint_Hinge_Motor_Control(int Constraint,bool Enabled,float TargetVelocity,float MaxImpulse);

Constraint is a valid hinge constraint and MaxImpulse is not negative.

If Enabled is true then Constraint's engine is activated. If Enabled is false then Constraint's engine is not applying any torque. Constraint's engine's target velocity is set to TargetVelocity. Constraint's engine's maximum impulse is set to MaxImpulse.

int Constraint_GetRigidBodyA(int Constraint);

Constraint is a valid constraint.

Returns the ID of Constraint's RigidBodyA. Returns -1 if the precondition is broken.

int Constraint_GetRigidBodyB(int Constraint);

Constraint is a valid constraint.

Returns the ID of Constraint's RigidBodyB. Returns -1 if the precondition is broken.