diff options
author | WenlongLu <wenlong.will.lu@gmail.com> | 2020-12-14 17:19:27 -0800 |
---|---|---|
committer | WenlongLu <wenlong.will.lu@gmail.com> | 2020-12-14 17:19:27 -0800 |
commit | 62eb2f778825efe7cf84aa93542118cb163e551b (patch) | |
tree | be94589964b6875cc24cfbd6572a897ef71c87d7 /src | |
parent | c377260d71ddb71236c37f49d394f2d8d4e8a52f (diff) | |
download | bullet3-62eb2f778825efe7cf84aa93542118cb163e551b.tar.gz |
Disable velocity calculation in kinematic multibody mode by default
We haven't implemented this for the multi body joints. To be consistent, let's disable it for the base as well, and let user to set the velocities.
Diffstat (limited to 'src')
-rw-r--r-- | src/BulletDynamics/Featherstone/btMultiBody.cpp | 5 | ||||
-rw-r--r-- | src/BulletDynamics/Featherstone/btMultiBody.h | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/BulletDynamics/Featherstone/btMultiBody.cpp b/src/BulletDynamics/Featherstone/btMultiBody.cpp index bec8c6530..7cb92fa3b 100644 --- a/src/BulletDynamics/Featherstone/btMultiBody.cpp +++ b/src/BulletDynamics/Featherstone/btMultiBody.cpp @@ -125,7 +125,8 @@ btMultiBody::btMultiBody(int n_links, m_posVarCnt(0), m_useRK4(false), m_useGlobalVelocities(false), - m_internalNeedsJointFeedback(false) + m_internalNeedsJointFeedback(false), + m_kinematic_calculate_velocity(false) { m_cachedInertiaTopLeft.setValue(0, 0, 0, 0, 0, 0, 0, 0, 0); m_cachedInertiaTopRight.setValue(0, 0, 0, 0, 0, 0, 0, 0, 0); @@ -2381,7 +2382,7 @@ const char *btMultiBody::serialize(void *dataBuffer, class btSerializer *seriali void btMultiBody::saveKinematicState(btScalar timeStep) { //todo: clamp to some (user definable) safe minimum timestep, to limit maximum angular/linear velocities - if (timeStep != btScalar(0.)) + if (m_kinematic_calculate_velocity && timeStep != btScalar(0.)) { btVector3 linearVelocity, angularVelocity; btTransformUtil::calculateVelocity(getInterpolateBaseWorldTransform(), getBaseWorldTransform(), timeStep, linearVelocity, angularVelocity); diff --git a/src/BulletDynamics/Featherstone/btMultiBody.h b/src/BulletDynamics/Featherstone/btMultiBody.h index 25112a680..5a3efc941 100644 --- a/src/BulletDynamics/Featherstone/btMultiBody.h +++ b/src/BulletDynamics/Featherstone/btMultiBody.h @@ -823,6 +823,9 @@ private: ///the m_needsJointFeedback gets updated/computed during the stepVelocitiesMultiDof and it for internal usage only bool m_internalNeedsJointFeedback; + + //If enabled, calculate the velocity based on kinematic transform changes. Currently only implemented for the base. + bool m_kinematic_calculate_velocity; }; struct btMultiBodyLinkDoubleData |