diff --git a/OdeWorld.cc b/OdeWorld.cc index 342c2a9..65681b3 100644 --- a/OdeWorld.cc +++ b/OdeWorld.cc @@ -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); diff --git a/OdeWorld.h b/OdeWorld.h index cf6934b..da0165d 100644 --- a/OdeWorld.h +++ b/OdeWorld.h @@ -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) {