added support for hinge joints with anchor and axis

git-svn-id: svn://anubis/misc/OdeWorld@228 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
josh 2010-01-31 06:07:36 +00:00
parent 2b058ed5a5
commit c9d3242314
2 changed files with 21 additions and 0 deletions

View File

@ -115,6 +115,17 @@ dJointID OdeWorld::createAMotor(dBodyID b1, dBodyID b2)
return j;
}
dJointID OdeWorld::createHinge(dBodyID b1, dBodyID b2,
dReal anchor_x, dReal anchor_y, dReal anchor_z,
dReal axis_x, dReal axis_y, dReal axis_z)
{
dJointID j = dJointCreateHinge(m_world, 0);
dJointAttach(j, b1, b2);
dJointSetHingeAnchor(j, anchor_x, anchor_y, anchor_z);
dJointSetHingeAxis(j, axis_x, axis_y, axis_z);
return j;
}
void OdeWorld::destroyBody(dBodyID body)
{
m_bodies.erase(body);

View File

@ -84,6 +84,9 @@ class OdeWorld
void enableAllBodies();
dWorldID getWorldID() { return m_world; }
dJointID createAMotor(dBodyID b1, dBodyID b2);
dJointID createHinge(dBodyID b1, dBodyID b2,
dReal anchor_x, dReal anchor_y, dReal anchor_z,
dReal axis_x, dReal axis_y, dReal axis_z);
void setAMotorNumAxes(dJointID j, int num_axes)
{
#ifdef DEBUG_AMOTOR
@ -91,6 +94,13 @@ class OdeWorld
#endif
dJointSetAMotorNumAxes(j, num_axes);
}
void setAMotorAngle(dJointID j, int anum, dReal val)
{
#ifdef DEBUG_AMOTOR
cout << "angle: " << val << endl;
#endif
dJointSetAMotorAngle(j, anum, val);
}
void setAMotorAxis(dJointID j, int anum, int rel,
dReal x, dReal y, dReal z)
{