From 38b29f47091b0f22ef41bd2718e66d3851ed0edd Mon Sep 17 00:00:00 2001 From: Anthony Thibault Date: Tue, 23 Feb 2016 13:26:15 -0800 Subject: [PATCH] Revert "Physics: extrapolate kinematic objects as well as dynamic ones." This reverts commit e544275500a10cce28427b8d088fb0df0a19fad6. --- libraries/physics/src/EntityMotionState.cpp | 2 +- .../physics/src/ThreadSafeDynamicsWorld.cpp | 19 ++++++------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index ff7d550175..8c0dab98db 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -191,7 +191,7 @@ void EntityMotionState::getWorldTransform(btTransform& worldTrans) const { } // This callback is invoked by the physics simulation at the end of each simulation step... -// iff the corresponding RigidBody is active. +// iff the corresponding RigidBody is DYNAMIC and has moved. void EntityMotionState::setWorldTransform(const btTransform& worldTrans) { if (!_entity) { return; diff --git a/libraries/physics/src/ThreadSafeDynamicsWorld.cpp b/libraries/physics/src/ThreadSafeDynamicsWorld.cpp index 17b2b08d4d..b6f3487f1a 100644 --- a/libraries/physics/src/ThreadSafeDynamicsWorld.cpp +++ b/libraries/physics/src/ThreadSafeDynamicsWorld.cpp @@ -96,26 +96,19 @@ void ThreadSafeDynamicsWorld::synchronizeMotionState(btRigidBody* body) { ///@todo: add 'dirty' flag //if (body->getActivationState() != ISLAND_SLEEPING) { - btTransform bodyTransform; - btVector3 bodyLinearVelocity, bodyAngularVelocity; if (body->isKinematicObject()) { ObjectMotionState* objectMotionState = static_cast(body->getMotionState()); if (objectMotionState->hasInternalKinematicChanges()) { objectMotionState->clearInternalKinematicChanges(); + body->getMotionState()->setWorldTransform(body->getWorldTransform()); } - bodyTransform = body->getWorldTransform(); - bodyLinearVelocity = body->getLinearVelocity(); - bodyAngularVelocity = body->getAngularVelocity(); - } else { - bodyTransform = body->getInterpolationWorldTransform(); - bodyLinearVelocity = body->getInterpolationLinearVelocity(); - bodyAngularVelocity = body->getInterpolationAngularVelocity(); + return; } - - // integrate the object foward to cover the time in-between fixed time steps. - btScalar dt = (m_latencyMotionStateInterpolation && m_fixedTimeStep) ? m_localTime - m_fixedTimeStep : m_localTime * body->getHitFraction(); btTransform interpolatedTransform; - btTransformUtil::integrateTransform(bodyTransform, bodyLinearVelocity, bodyAngularVelocity, dt, interpolatedTransform); + btTransformUtil::integrateTransform(body->getInterpolationWorldTransform(), + body->getInterpolationLinearVelocity(),body->getInterpolationAngularVelocity(), + (m_latencyMotionStateInterpolation && m_fixedTimeStep) ? m_localTime - m_fixedTimeStep : m_localTime*body->getHitFraction(), + interpolatedTransform); body->getMotionState()->setWorldTransform(interpolatedTransform); } }