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:
parent
2b058ed5a5
commit
c9d3242314
11
OdeWorld.cc
11
OdeWorld.cc
@ -115,6 +115,17 @@ dJointID OdeWorld::createAMotor(dBodyID b1, dBodyID b2)
|
|||||||
return j;
|
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)
|
void OdeWorld::destroyBody(dBodyID body)
|
||||||
{
|
{
|
||||||
m_bodies.erase(body);
|
m_bodies.erase(body);
|
||||||
|
10
OdeWorld.h
10
OdeWorld.h
@ -84,6 +84,9 @@ class OdeWorld
|
|||||||
void enableAllBodies();
|
void enableAllBodies();
|
||||||
dWorldID getWorldID() { return m_world; }
|
dWorldID getWorldID() { return m_world; }
|
||||||
dJointID createAMotor(dBodyID b1, dBodyID b2);
|
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)
|
void setAMotorNumAxes(dJointID j, int num_axes)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_AMOTOR
|
#ifdef DEBUG_AMOTOR
|
||||||
@ -91,6 +94,13 @@ class OdeWorld
|
|||||||
#endif
|
#endif
|
||||||
dJointSetAMotorNumAxes(j, num_axes);
|
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,
|
void setAMotorAxis(dJointID j, int anum, int rel,
|
||||||
dReal x, dReal y, dReal z)
|
dReal x, dReal y, dReal z)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user