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:
@@ -22,6 +22,9 @@
|
|||||||
#include "LinearMath/btIDebugDraw.h"
|
#include "LinearMath/btIDebugDraw.h"
|
||||||
#include "BulletDynamics/ConstraintSolver/btContactConstraint.h"
|
#include "BulletDynamics/ConstraintSolver/btContactConstraint.h"
|
||||||
|
|
||||||
|
#define ROLLING_INFLUENCE_FIX
|
||||||
|
|
||||||
|
|
||||||
btRigidBody& btActionInterface::getFixedBody()
|
btRigidBody& btActionInterface::getFixedBody()
|
||||||
{
|
{
|
||||||
static btRigidBody s_fixed(0, 0,0);
|
static btRigidBody s_fixed(0, 0,0);
|
||||||
@@ -694,7 +697,12 @@ void btRaycastVehicle::updateFriction(btScalar timeStep)
|
|||||||
|
|
||||||
btVector3 sideImp = m_axle[wheel] * m_sideImpulse[wheel];
|
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;
|
rel_pos[m_indexUpAxis] *= wheelInfo.m_rollInfluence;
|
||||||
|
#endif
|
||||||
m_chassisBody->applyImpulse(sideImp,rel_pos);
|
m_chassisBody->applyImpulse(sideImp,rel_pos);
|
||||||
|
|
||||||
//apply friction impulse on the ground
|
//apply friction impulse on the ground
|
||||||
|
|||||||
Reference in New Issue
Block a user