mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
Avoid unnecessary AABB update when actor position has not changed
This commit is contained in:
parent
fb073e5c14
commit
a55604c549
1 changed files with 6 additions and 2 deletions
|
@ -1419,13 +1419,17 @@ namespace MWPhysics
|
||||||
|
|
||||||
osg::Vec3f position = physicActor->getPosition();
|
osg::Vec3f position = physicActor->getPosition();
|
||||||
float oldHeight = position.z();
|
float oldHeight = position.z();
|
||||||
|
bool positionChanged = false;
|
||||||
for (int i=0; i<numSteps; ++i)
|
for (int i=0; i<numSteps; ++i)
|
||||||
{
|
{
|
||||||
position = MovementSolver::move(position, physicActor->getPtr(), physicActor, iter->second, physicsDt,
|
position = MovementSolver::move(position, physicActor->getPtr(), physicActor, iter->second, physicsDt,
|
||||||
world->isFlying(iter->first),
|
world->isFlying(iter->first),
|
||||||
waterlevel, slowFall, mCollisionWorld, mStandingCollisions);
|
waterlevel, slowFall, mCollisionWorld, mStandingCollisions);
|
||||||
physicActor->setPosition(position);
|
if (position != physicActor->getPosition())
|
||||||
|
positionChanged = true;
|
||||||
|
physicActor->setPosition(position); // always set even if unchanged to make sure interpolation is correct
|
||||||
}
|
}
|
||||||
|
if (positionChanged)
|
||||||
mCollisionWorld->updateSingleAabb(physicActor->getCollisionObject());
|
mCollisionWorld->updateSingleAabb(physicActor->getCollisionObject());
|
||||||
|
|
||||||
float interpolationFactor = mTimeAccum / physicsDt;
|
float interpolationFactor = mTimeAccum / physicsDt;
|
||||||
|
|
Loading…
Reference in a new issue