mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 04:13:11 +02:00
Revert "Physics: extrapolate kinematic objects as well as dynamic ones."
This reverts commit e544275500
.
This commit is contained in:
parent
e544275500
commit
38b29f4709
2 changed files with 7 additions and 14 deletions
|
@ -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...
|
// 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) {
|
void EntityMotionState::setWorldTransform(const btTransform& worldTrans) {
|
||||||
if (!_entity) {
|
if (!_entity) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -96,26 +96,19 @@ void ThreadSafeDynamicsWorld::synchronizeMotionState(btRigidBody* body) {
|
||||||
///@todo: add 'dirty' flag
|
///@todo: add 'dirty' flag
|
||||||
//if (body->getActivationState() != ISLAND_SLEEPING)
|
//if (body->getActivationState() != ISLAND_SLEEPING)
|
||||||
{
|
{
|
||||||
btTransform bodyTransform;
|
|
||||||
btVector3 bodyLinearVelocity, bodyAngularVelocity;
|
|
||||||
if (body->isKinematicObject()) {
|
if (body->isKinematicObject()) {
|
||||||
ObjectMotionState* objectMotionState = static_cast<ObjectMotionState*>(body->getMotionState());
|
ObjectMotionState* objectMotionState = static_cast<ObjectMotionState*>(body->getMotionState());
|
||||||
if (objectMotionState->hasInternalKinematicChanges()) {
|
if (objectMotionState->hasInternalKinematicChanges()) {
|
||||||
objectMotionState->clearInternalKinematicChanges();
|
objectMotionState->clearInternalKinematicChanges();
|
||||||
|
body->getMotionState()->setWorldTransform(body->getWorldTransform());
|
||||||
}
|
}
|
||||||
bodyTransform = body->getWorldTransform();
|
return;
|
||||||
bodyLinearVelocity = body->getLinearVelocity();
|
|
||||||
bodyAngularVelocity = body->getAngularVelocity();
|
|
||||||
} else {
|
|
||||||
bodyTransform = body->getInterpolationWorldTransform();
|
|
||||||
bodyLinearVelocity = body->getInterpolationLinearVelocity();
|
|
||||||
bodyAngularVelocity = body->getInterpolationAngularVelocity();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
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);
|
body->getMotionState()->setWorldTransform(interpolatedTransform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue