I'm using Bullet 2.78. I was happily using a btConeTwistConstraint until I decided I wanted to motorize it.
When I tried enabling the motor it worked fine, except that it was way too fast, and calling setMaxMotorImpulse passing in a small value seemed to have no effect. Looking at the code I realised that m_maxMotorImpulse is only used by the 'obsolete' branch.
So I set CONETWIST_USE_OBSOLETE_SOLVER to true and tried again, but I found I was getting NANs in my angular velocities. The source seemed to be from the following bit of code in btConeTwistConstraint.cpp:
Code: Select all
btVector3 impulseAxis = impulse / impulseMag;
bodyA.internalApplyImpulse(btVector3(0,0,0), m_rbA.getInvInertiaTensorWorld()*impulseAxis, impulseMag);
bodyB.internalApplyImpulse(btVector3(0,0,0), m_rbB.getInvInertiaTensorWorld()*impulseAxis, -impulseMag);
Code: Select all
if (impulseMag > 0.f)
I looked in the forums and found someone saying that the cone twist constraint motor is still work in progress. So my questions I guess are:
- Will m_maxMotorImpulse make it into the non-obsolete solver?
- Is my fix correct for the obsolete solver?
Thanks.