Add some accessor methods to btHingeConstraint and btSliderConstraint, to allow conversion.

Thanks to Roman Ponomarev.
This commit is contained in:
erwin.coumans
2008-07-22 02:15:17 +00:00
parent 016db0b3c5
commit fe5033119b
4 changed files with 648 additions and 610 deletions

View File

@@ -403,3 +403,4 @@ btScalar btHingeConstraint::getHingeAngle()
return btAtan2Fast( swingAxis.dot(refAxis0), swingAxis.dot(refAxis1) );
}

View File

@@ -136,6 +136,23 @@ public:
return m_limitSign;
}
inline bool getAngularOnly()
{
return m_angularOnly;
}
inline bool getEnableAngularMotor()
{
return m_enableAngularMotor;
}
inline btScalar getMotorTargetVelosity()
{
return m_motorTargetVelocity;
}
inline btScalar getMaxMotorImpulse()
{
return m_maxMotorImpulse;
}
};
#endif //HINGECONSTRAINT_H

View File

@@ -395,3 +395,20 @@ void btSliderConstraint::testAngLimits(void)
//-----------------------------------------------------------------------------
btVector3 btSliderConstraint::getAncorInA(void)
{
btVector3 ancorInA;
ancorInA = m_realPivotAInW + (m_lowerLinLimit + m_upperLinLimit) * btScalar(0.5) * m_sliderAxis;
ancorInA = m_rbA.getCenterOfMassTransform().inverse() * ancorInA;
return ancorInA;
} // btSliderConstraint::getAncorInA()
//-----------------------------------------------------------------------------
btVector3 btSliderConstraint::getAncorInB(void)
{
btVector3 ancorInB;
ancorInB = m_frameInB.getOrigin();
return ancorInB;
} // btSliderConstraint::getAncorInB();

View File

@@ -204,6 +204,9 @@ public:
void calculateTransforms(void);
void testLinLimits(void);
void testAngLimits(void);
// access for PE Solver
btVector3 getAncorInA(void);
btVector3 getAncorInB(void);
};
//-----------------------------------------------------------------------------