[ODE] joint limits for ball+universal

Jeffrey Smith jeffreys at Softimage.com
Tue Mar 23 14:27:53 MST 2004


So then, Andrew Chapman was all like:
> it seems like you can specify joint limits for hinges, but not for
> ball+socket joints or for universal joints (which are really just
> two hinges in one joint).

True.  However, you can use amotors to "fake" joint limits for ball
and socket joints.  I imagine this technique can be extended to
universal joints, but I haven't tried it.  Here's a code snippet
that gives you the idea:

    dJointSetAMotorMode (myjoint->motor, dAMotorEuler);

    DrvVector_MultiplyQuaternion(&x, (DrvVector *)&NORMALX, &myjoint->home.rotation);
    dJointSetAMotorAxis (myjoint->motor, 0, 1, x.x, x.y, x.z);

    DrvVector_MultiplyQuaternion(&z, (DrvVector *)&NORMALZ, &myjoint->home.rotation);
    dJointSetAMotorAxis (myjoint->motor, 2, 2, z.x, z.y, z.z);

    dJointSetAMotorParam(myjoint->motor, dParamLoStop, low.x);
    dJointSetAMotorParam(myjoint->motor, dParamHiStop, up.x);
    dJointSetAMotorParam(myjoint->motor, dParamVel, 0.0);
    dJointSetAMotorParam(myjoint->motor, dParamFMax, 25.0);
    dJointSetAMotorParam(myjoint->motor, dParamBounce, 0.5);

    dJointSetAMotorParam(myjoint->motor, dParamLoStop2, low.y);
    dJointSetAMotorParam(myjoint->motor, dParamHiStop2, up.y);
    dJointSetAMotorParam(myjoint->motor, dParamVel2, 0.0);
    dJointSetAMotorParam(myjoint->motor, dParamFMax2, 25.0);
    dJointSetAMotorParam(myjoint->motor, dParamBounce2, 0.5);
				
    dJointSetAMotorParam(myjoint->motor, dParamLoStop3, low.z);
    dJointSetAMotorParam(myjoint->motor, dParamHiStop3, up.z);
    dJointSetAMotorParam(myjoint->motor, dParamVel3, 0.0);
    dJointSetAMotorParam(myjoint->motor, dParamFMax3, 25.0);
    dJointSetAMotorParam(myjoint->motor, dParamBounce3, 0.5);


-jeff



More information about the ODE mailing list