From a165ff54c9e6ec789945a3d7c7e37cda47573efb Mon Sep 17 00:00:00 2001 From: erwin coumans Date: Wed, 29 Apr 2015 11:05:00 -0700 Subject: [PATCH] fix maxLinMotorForce/maxAngMotorForce in btSliderConstraint Thanks to Stephen Peters, see also https://github.com/bulletphysics/bullet3/pull/328 --- examples/ForkLift/ForkLiftDemo.cpp | 2 +- examples/Vehicles/Hinge2Vehicle.cpp | 2 +- .../ConstraintSolver/btSliderConstraint.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/ForkLift/ForkLiftDemo.cpp b/examples/ForkLift/ForkLiftDemo.cpp index aeb7de013..df380fec3 100644 --- a/examples/ForkLift/ForkLiftDemo.cpp +++ b/examples/ForkLift/ForkLiftDemo.cpp @@ -155,7 +155,7 @@ class ForkLiftDemo : public ExampleInterface }; -btScalar maxMotorImpulse = 1400.f; +btScalar maxMotorImpulse = 4000.f; //the sequential impulse solver has difficulties dealing with large mass ratios (differences), between loadMass and the fork parts btScalar loadMass = 350.f;// diff --git a/examples/Vehicles/Hinge2Vehicle.cpp b/examples/Vehicles/Hinge2Vehicle.cpp index ff8e44434..afeefb72a 100644 --- a/examples/Vehicles/Hinge2Vehicle.cpp +++ b/examples/Vehicles/Hinge2Vehicle.cpp @@ -131,7 +131,7 @@ class Hinge2Vehicle : public CommonRigidBodyBase }; -static btScalar maxMotorImpulse = 1400.f; +static btScalar maxMotorImpulse = 4000.f; //the sequential impulse solver has difficulties dealing with large mass ratios (differences), between loadMass and the fork parts static btScalar loadMass = 350.f;// diff --git a/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp b/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp index aff9f27f5..f8f81bfe6 100755 --- a/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp +++ b/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp @@ -539,8 +539,8 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra btScalar tag_vel = getTargetLinMotorVelocity(); btScalar mot_fact = getMotorFactor(m_linPos, m_lowerLinLimit, m_upperLinLimit, tag_vel, info->fps * currERP); info->m_constraintError[srow] -= signFact * mot_fact * getTargetLinMotorVelocity(); - info->m_lowerLimit[srow] += -getMaxLinMotorForce() * info->fps; - info->m_upperLimit[srow] += getMaxLinMotorForce() * info->fps; + info->m_lowerLimit[srow] += -getMaxLinMotorForce() / info->fps; + info->m_upperLimit[srow] += getMaxLinMotorForce() / info->fps; } if(limit) { @@ -641,8 +641,8 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra } btScalar mot_fact = getMotorFactor(m_angPos, m_lowerAngLimit, m_upperAngLimit, getTargetAngMotorVelocity(), info->fps * currERP); info->m_constraintError[srow] = mot_fact * getTargetAngMotorVelocity(); - info->m_lowerLimit[srow] = -getMaxAngMotorForce() * info->fps; - info->m_upperLimit[srow] = getMaxAngMotorForce() * info->fps; + info->m_lowerLimit[srow] = -getMaxAngMotorForce() / info->fps; + info->m_upperLimit[srow] = getMaxAngMotorForce() / info->fps; } if(limit) {