pXcon_add6djoint ( entity1, entity2, VECTOR* globalAnchor, VECTOR* globalAxis, var limits[5] );

Create a “6-Degrees-of-Freedom Configurable Joint” with this function. This joint type can be configured to model nearly any joint imaginable.

Parameters:

entity1

registered Entity pointer (Actor) , can be NULL

entity2

registered Entity pointer (Actor)

globalAnchor

Set the a global anchor point.

globalAxis

Set the a global axis.

limits[5]

limits[0] = LinearLimit
limits[1] = swing1Limit
limits[2] = swing2Limit
limits[3] = twistLimit.low
limits[4] = twistLimit.high


Returns:

1 if successful, 0 otherwise.

Remarks:

Speed:

Fast

Example:

VECTOR* globalAxis = vector(0,0,-1); // using the z axis
var limits[5];
limits[0] = 1.0;
// linearLimit
limits[1] = NxPiF32 / 180.0 * 30.0;
// swing1Limit
limits[2] = NxPiF32 / 180.0 * 70.0; /
/ swing2Limit
limits[3] = NxPiF32 / 180.0 * -90.0;
// TwistLowLimit
limits[4] = NxPiF32 / 180.0 * 45.0;
// TwistHighLimit

// upper joint

pXcon_add6djoint(NULL, box4, box4.x, globalAxis, limits);
// when you use NULL you attach the entity (box4) to the world
// lower joint
pXcon_add6djoint(box4, box5, box5.x, globalAxis, limits);

var Motion[6];
Motion[0] = NX_D6JOINT_MOTION_FREE;
// This frees box4 from the world (NULL)
Motion[1] = NX_D6JOINT_MOTION_FREE;
Motion[2] = NX_D6JOINT_MOTION_FREE;
Motion[3] = NX_D6JOINT_MOTION_LIMITED;
//this limits the angles
Motion[4] = NX_D6JOINT_MOTION_LIMITED;
Motion[5] = NX_D6JOINT_MOTION_LIMITED;

pXcon_edit6djoint(box4,Motion);

Motion[0] = NX_D6JOINT_MOTION_LOCKED;
//this locks box5 on box4
Motion[1] = NX_D6JOINT_MOTION_LOCKED;
Motion[2] = NX_D6JOINT_MOTION_LOCKED;

pXcon_edit6djoint(box5,Motion);

See also:

pXcon_edit6djoint