Hey there,
I want to constraint the rotation of a cube so that it can only translate. I've tried using an aMotor with the following code:
this->aMotor=dJointCreateAMotor(this->system->getGame()->worldID,this->system->jointGroup);
dJointAttach(this->aMotor,0,this->bodyID);
dJointSetAMotorMode(this->aMotor,dAMotorUser);
dJointSetAMotorNumAxes(this->aMotor,3);
dJointSetAMotorAxis(this->aMotor,0,0,1,0,0);
dJointSetAMotorAxis(this->aMotor,1,0,0,1,0);
dJointSetAMotorAxis(this->aMotor,2,0,0,0,1);
dJointSetAMotorParam(this->aMotor, dParamVel1, 0);
dJointSetAMotorParam(this->aMotor, dParamVel2, 0);
dJointSetAMotorParam(this->aMotor, dParamVel3, 0);
dJointSetAMotorParam(this->aMotor, dParamFMax1, dInfinity);
dJointSetAMotorParam(this->aMotor, dParamFMax2, dInfinity);
dJointSetAMotorParam(this->aMotor, dParamFMax3, dInfinity);
If i'm not mistaken, that code creates an AMotor joint, attaches it to the body and the world, and sets the target velocity of each axis of the motor to be 0 and the FMax to be dInfinity. I thought that would disable the body's rotation, but it does nothing. Is there anything wrong with my code? Do you know any other way to constrain the rotation?
Thanks in advance