- initialize m_unusedW to avoid some warnings.

- added angularFactor to 'cachefriendly' constraint solver
This commit is contained in:
ejcoumans 2007-04-23 10:52:38 +00:00
parent be73a0e5d6
commit 82c8687881
3 changed files with 6 additions and 13 deletions

View File

@ -138,6 +138,7 @@ void initSolverBody(btSolverBody* solverBody, btRigidBody* rigidbody)
solverBody->m_invMass = rigidbody->getInvMass();
solverBody->m_linearVelocity = rigidbody->getLinearVelocity();
solverBody->m_originalBody = rigidbody;
solverBody->m_angularFactor = rigidbody->getAngularFactor();
}
btScalar penetrationResolveFactor = btScalar(0.9);

View File

@ -31,7 +31,7 @@ ATTRIBUTE_ALIGNED16 (struct) btSolverBody
btRigidBody* m_originalBody;
float m_invMass;
float m_friction;
float m_unused;
float m_angularFactor;
inline void getVelocityInLocalPoint(const btVector3& rel_pos, btVector3& velocity ) const
{
@ -40,9 +40,9 @@ ATTRIBUTE_ALIGNED16 (struct) btSolverBody
//Optimization for the iterative solver: avoid calculating constant terms involving inertia, normal, relative position
inline void internalApplyImpulse(const btVector3& linearComponent, const btVector3& angularComponent,btScalar impulseMagnitude)
{
{
m_linearVelocity += linearComponent*impulseMagnitude;
m_angularVelocity += angularComponent*impulseMagnitude;
m_angularVelocity += angularComponent*impulseMagnitude*m_angularFactor;
}
void writebackVelocity()
@ -65,16 +65,7 @@ ATTRIBUTE_ALIGNED16 (struct) btSolverBody
inline void applyImpulse(const btVector3& impulse,const btVector3& rel_pos)
{
if (m_invMass)
{
m_linearVelocity += impulse * m_invMass;
btVector3 torqueImpulse = rel_pos.cross(impulse);
// m_angularVelocity += m_invInertiaWorld * torqueImpulse;
}
}
};
#endif //BT_SOLVER_BODY_H
#endif //BT_SOLVER_BODY_H

View File

@ -66,6 +66,7 @@ class btQuadWord
m_x=x;
m_y=y;
m_z=z;
m_unusedW = 0.f;
}
/* void getValue(btScalar *m) const