diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index 06afa2817c..c1ea461d2e 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -947,9 +947,10 @@ bool EntityItem::stepKinematicMotion(float timeElapsed) { && glm::length2(linearVelocity) < MIN_KINEMATIC_LINEAR_SPEED_SQUARED) { linearVelocity = Vectors::ZERO; } else { - // position's acceleration term uses deltaVelocity rather than raw gravity - // for more accuracy (includes damping effects) - position += timeElapsed * (linearVelocity + 0.5f * deltaVelocity); + // NOTE: we do NOT include the second-order acceleration term (0.5 * a * dt^2) + // when computing the displacement because Bullet also ignores that term. Yes, + // this is an approximation and it works best when dt is small. + position += timeElapsed * linearVelocity; linearVelocity += deltaVelocity; } } else { diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index 8ef4d7ac4b..f4e6b796e4 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -309,6 +309,8 @@ bool EntityMotionState::remoteSimulationOutOfSync(uint32_t simulationStep) { if (glm::length2(_serverVelocity) > 0.0f) { _serverVelocity += _serverAcceleration * dt; _serverVelocity *= powf(1.0f - _body->getLinearDamping(), dt); + // NOTE: we ignore the second-order acceleration term when integrating + // the position forward because Bullet also does this. _serverPosition += dt * _serverVelocity; }