- initialize m_unusedW to avoid some warnings.
- added angularFactor to 'cachefriendly' constraint solver
This commit is contained in:
@@ -138,6 +138,7 @@ void initSolverBody(btSolverBody* solverBody, btRigidBody* rigidbody)
|
|||||||
solverBody->m_invMass = rigidbody->getInvMass();
|
solverBody->m_invMass = rigidbody->getInvMass();
|
||||||
solverBody->m_linearVelocity = rigidbody->getLinearVelocity();
|
solverBody->m_linearVelocity = rigidbody->getLinearVelocity();
|
||||||
solverBody->m_originalBody = rigidbody;
|
solverBody->m_originalBody = rigidbody;
|
||||||
|
solverBody->m_angularFactor = rigidbody->getAngularFactor();
|
||||||
}
|
}
|
||||||
|
|
||||||
btScalar penetrationResolveFactor = btScalar(0.9);
|
btScalar penetrationResolveFactor = btScalar(0.9);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ ATTRIBUTE_ALIGNED16 (struct) btSolverBody
|
|||||||
btRigidBody* m_originalBody;
|
btRigidBody* m_originalBody;
|
||||||
float m_invMass;
|
float m_invMass;
|
||||||
float m_friction;
|
float m_friction;
|
||||||
float m_unused;
|
float m_angularFactor;
|
||||||
|
|
||||||
inline void getVelocityInLocalPoint(const btVector3& rel_pos, btVector3& velocity ) const
|
inline void getVelocityInLocalPoint(const btVector3& rel_pos, btVector3& velocity ) const
|
||||||
{
|
{
|
||||||
@@ -42,7 +42,7 @@ ATTRIBUTE_ALIGNED16 (struct) btSolverBody
|
|||||||
inline void internalApplyImpulse(const btVector3& linearComponent, const btVector3& angularComponent,btScalar impulseMagnitude)
|
inline void internalApplyImpulse(const btVector3& linearComponent, const btVector3& angularComponent,btScalar impulseMagnitude)
|
||||||
{
|
{
|
||||||
m_linearVelocity += linearComponent*impulseMagnitude;
|
m_linearVelocity += linearComponent*impulseMagnitude;
|
||||||
m_angularVelocity += angularComponent*impulseMagnitude;
|
m_angularVelocity += angularComponent*impulseMagnitude*m_angularFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void writebackVelocity()
|
void writebackVelocity()
|
||||||
@@ -65,15 +65,6 @@ 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ class btQuadWord
|
|||||||
m_x=x;
|
m_x=x;
|
||||||
m_y=y;
|
m_y=y;
|
||||||
m_z=z;
|
m_z=z;
|
||||||
|
m_unusedW = 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* void getValue(btScalar *m) const
|
/* void getValue(btScalar *m) const
|
||||||
|
|||||||
Reference in New Issue
Block a user