I would like to know how to get the total energy applied by motors to each hinge joint of my simulation,
I can get it like that in bullet 2.73 :
Code: Select all
// before the Step :
for (int = 0; i < nb_joint; i++)
{
joint[i]->motorImpulseInThatStep = 0;
}
// modification of btHingeConstraint::solveConstraintObsolete
void btHingeConstraint::solveConstraintObsolete(btSolverBody& bodyA,btSolverBody& bodyB,btScalar timeStep)
{
....
if (m_enableAngularMotor)
{
clippedMotorImpulse = ... ;
motorImpulseInThatStep += clippedMotorImpulse;
}
}
// after the Step
for (int = 0; i < nb_joint; i++)
{
float imp = joint[i]->motorImpulseInThatStep;
totalEnergy += imp*imp;
}