joint limits

Grom

31-01-2007 17:15:19

I've read all across the ageia forums and these, and I can't figure out how to create joint limits. I see in the nxOgre demo that the revolute joint can be passed a limits parameter, but I don't see one for the spherical joint.

Are joint limits specific to revolute joints only?

NickM

31-01-2007 17:53:26

This is how I set up a spherical joint with limits...

void connectCaravan(nxOgre::scene* mScene, body* vehicle, body* caravan, NxVec3 jointPos)
{
// create a spherical joint.
NxSphericalJointDesc sphJointDesc;
sphJointDesc.actor[0] = vehicle->mActor;
sphJointDesc.actor[1] = caravan->mActor;
sphJointDesc.setGlobalAnchor(jointPos);
sphJointDesc.setGlobalAxis(NxVec3(0,0,-1));
sphJointDesc.swingAxis.set(0,0,1);
sphJointDesc.twistLimit.low.value = NxMath::degToRad( -56.0f);
sphJointDesc.twistLimit.high.value = NxMath::degToRad( 56.0f);
sphJointDesc.swingLimit.value = NxMath::degToRad( 90.0f);
sphJointDesc.flags |= NX_SJF_TWIST_LIMIT_ENABLED;
sphJointDesc.flags |= NX_SJF_SWING_LIMIT_ENABLED;
mScene->mScene->createJoint(sphJointDesc);
}


Hopefully that will give you some idea.

Grom

31-01-2007 23:33:18

much obliged!