Applied rolling-influence fix. For backwards compatibility, you can un-comment the #define ROLLING_INFLUENCE_FIX in btRaycastVehicle.cpp

Thanks to Vlad Turchenko for the report and fix, see Issue 468
This commit is contained in:
erwin.coumans
2010-12-23 02:01:54 +00:00
parent cb4ae2f3b9
commit 4c3a31077b

View File

@@ -22,6 +22,9 @@
#include "LinearMath/btIDebugDraw.h"
#include "BulletDynamics/ConstraintSolver/btContactConstraint.h"
#define ROLLING_INFLUENCE_FIX
btRigidBody& btActionInterface::getFixedBody()
{
static btRigidBody s_fixed(0, 0,0);
@@ -694,7 +697,12 @@ void btRaycastVehicle::updateFriction(btScalar timeStep)
btVector3 sideImp = m_axle[wheel] * m_sideImpulse[wheel];
#if defined ROLLING_INFLUENCE_FIX // fix. It only worked if car's up was along Y - VT.
btVector3 vChassisWorldUp = getRigidBody()->getCenterOfMassTransform().getBasis().getColumn(1);
rel_pos -= vChassisWorldUp * (vChassisWorldUp.dot(rel_pos) * wheelInfo.m_rollInfluence);
#else
rel_pos[m_indexUpAxis] *= wheelInfo.m_rollInfluence;
#endif
m_chassisBody->applyImpulse(sideImp,rel_pos);
//apply friction impulse on the ground