return 0f;
}
@StaticAlloc
protected void addFrictionConstraint(Vector3f normalAxis, int solverBodyIdA, int solverBodyIdB, int frictionIndex, ManifoldPoint cp, Vector3f rel_pos1, Vector3f rel_pos2, CollisionObject colObj0, CollisionObject colObj1, float relaxation) {
RigidBody body0 = RigidBody.upcast(colObj0);
RigidBody body1 = RigidBody.upcast(colObj1);
SolverConstraint solverConstraint = constraintsPool.get();
tmpSolverFrictionConstraintPool.add(solverConstraint);
solverConstraint.contactNormal.set(normalAxis);
solverConstraint.solverBodyIdA = solverBodyIdA;
solverConstraint.solverBodyIdB = solverBodyIdB;
solverConstraint.constraintType = SolverConstraintType.SOLVER_FRICTION_1D;
solverConstraint.frictionIndex = frictionIndex;
solverConstraint.friction = cp.combinedFriction;
solverConstraint.originalContactPoint = null;
solverConstraint.appliedImpulse = 0f;
solverConstraint.appliedPushImpulse = 0f;
solverConstraint.penetration = 0f;
Vector3f ftorqueAxis1 = Stack.alloc(Vector3f.class);
Matrix3f tmpMat = Stack.alloc(Matrix3f.class);
{
ftorqueAxis1.cross(rel_pos1, solverConstraint.contactNormal);
solverConstraint.relpos1CrossNormal.set(ftorqueAxis1);
if (body0 != null) {
solverConstraint.angularComponentA.set(ftorqueAxis1);
body0.getInvInertiaTensorWorld(tmpMat).transform(solverConstraint.angularComponentA);
}
else {
solverConstraint.angularComponentA.set(0f, 0f, 0f);
}
}
{
ftorqueAxis1.cross(rel_pos2, solverConstraint.contactNormal);
solverConstraint.relpos2CrossNormal.set(ftorqueAxis1);
if (body1 != null) {
solverConstraint.angularComponentB.set(ftorqueAxis1);
body1.getInvInertiaTensorWorld(tmpMat).transform(solverConstraint.angularComponentB);
}
else {
solverConstraint.angularComponentB.set(0f, 0f, 0f);
}
}
//#ifdef COMPUTE_IMPULSE_DENOM
// btScalar denom0 = rb0->computeImpulseDenominator(pos1,solverConstraint.m_contactNormal);
// btScalar denom1 = rb1->computeImpulseDenominator(pos2,solverConstraint.m_contactNormal);
//#else
Vector3f vec = Stack.alloc(Vector3f.class);
float denom0 = 0f;
float denom1 = 0f;
if (body0 != null) {
vec.cross(solverConstraint.angularComponentA, rel_pos1);
denom0 = body0.getInvMass() + normalAxis.dot(vec);
}
if (body1 != null) {
vec.cross(solverConstraint.angularComponentB, rel_pos2);
denom1 = body1.getInvMass() + normalAxis.dot(vec);
}
//#endif //COMPUTE_IMPULSE_DENOM
float denom = relaxation / (denom0 + denom1);
solverConstraint.jacDiagABInv = denom;