If yo uread teh FAQ in teh forum, you will get teh idea how to use teh 6DOF joint
viewtopic.php?f=15&t=3501There are varios exampel of how to make standrd joint by using the Custom6DOF,
For exampel a JHing with limit woudl be this
- Code: Select all
dMatrix pinsAndPivoFrame (location);
dVector minLinearLimits (0.0f, 0.0f, 0.0f, 0.0f);
dVector maxLinearLimits (0.0f, 0.0f, 0.0f, 0.0f);
dVector minAngularLimits (-30.0f * 3.1416 / 180.0f, 0.0f, 0.0f, 0.0f);
dVector maxAngularLimits ( 30.0f * 3.1416 / 180.0f, 0.0f, 0.0f, 0.0f);
new Custom6DOF (pinsAndPivoFrame, pinsAndPivoFrame, minLinearLimits, maxLinearLimits, minAngularLimits, maxAngularLimits, boxBody, NULL);
using the C interface would be sometjhing like this
// Generic 6 degree of Freedom Joint
JOINTLIBRARY_API void CustomJoint6DOF_SetLinearLimits (NewtonCustomJoint* customJoint6DOF, const dFloat* minLinearLimits, const dFloat* maxLinearLimits);
JOINTLIBRARY_API void CustomJoint6DOF_SetAngularLimits (NewtonCustomJoint* customJoint6DOF, const dFloat* minAngularLimits, const dFloat* maxAngularLimits);
JOINTLIBRARY_API void CustomJoint6DOF_GetLinearLimits (NewtonCustomJoint* customJoint6DOF, dFloat* minLinearLimits, dFloat* maxLinearLimits);
JOINTLIBRARY_API void CustomJoint6DOF_GetAngularLimits (NewtonCustomJoint* customJoint6DOF, dFloat* minAngularLimits, dFloat* maxAngularLimits);
JOINTLIBRARY_API void CustomJoint6DOF_SetReverseUniversal (NewtonCustomJoint* customJoint6DOF, int order);
- Code: Select all
set the matrix here (the last 4 float and the pivot, the firt threes floats is the pin direction)
float pinsAndPivoChildFrame[16] //
hinge = CreateCustomJoint6DOF (pinsAndPivoChildFrame, pinsAndPivoParentFrame, child, parent);
float lowLimitInradian; // a negative value
float highLimitInradian; // a positive value
float minLinearLimits[4] = (0.0f, 0.0f, 0.0f, 0.0f);
float maxLinearLimits[4] = (0.0f, 0.0f, 0.0f, 0.0f);
minAngularLimits (lowLimitInradian, 0.0f, 0.0f, 0.0f);
maxAngularLimits (highLimitInradian, 0.0f, 0.0f, 0.0f);
CustomJoint6DOF_SetLinearLimits (hinge, minLinearLimits, maxLinearLimits);
CustomJoint6DOF_SetAngularLimits (hinge, minAngularLimits, maxAngularLimits);
and badabim badabum you get a joint withe limits.
The Custom Hinge is for when you wnat to make soem special funtionality in teh callback itself.
It is also possible to make special funtionality using the #DOF fiund bu you will have to do the same precedure you nee to do fo custimizing the Hinge.
you can see the Custom joint like Shaders for the physics engine.