Merge branch 'racy_deadcode' into 'master'

Remove both racy and useless code.

See merge request OpenMW/openmw!896
pull/593/head
psi29a 4 years ago
commit f27d7c66ff

@ -117,27 +117,15 @@ int Actor::getCollisionMask() const
void Actor::updatePosition() void Actor::updatePosition()
{ {
std::scoped_lock lock(mPositionMutex); std::scoped_lock lock(mPositionMutex);
updateWorldPosition(); const auto worldPosition = mPtr.getRefData().getPosition().asVec3();
mPreviousPosition = mWorldPosition; mPreviousPosition = worldPosition;
mPosition = mWorldPosition; mPosition = worldPosition;
mSimulationPosition = mWorldPosition; mSimulationPosition = worldPosition;
mPositionOffset = osg::Vec3f(); mPositionOffset = osg::Vec3f();
mStandingOnPtr = nullptr; mStandingOnPtr = nullptr;
mSkipCollisions = true; mSkipCollisions = true;
} }
void Actor::updateWorldPosition()
{
if (mWorldPosition != mPtr.getRefData().getPosition().asVec3())
mWorldPositionChanged = true;
mWorldPosition = mPtr.getRefData().getPosition().asVec3();
}
osg::Vec3f Actor::getWorldPosition() const
{
return mWorldPosition;
}
void Actor::setSimulationPosition(const osg::Vec3f& position) void Actor::setSimulationPosition(const osg::Vec3f& position)
{ {
mSimulationPosition = position; mSimulationPosition = position;
@ -174,7 +162,6 @@ osg::Vec3f Actor::getCollisionObjectPosition() const
bool Actor::setPosition(const osg::Vec3f& position) bool Actor::setPosition(const osg::Vec3f& position)
{ {
std::scoped_lock lock(mPositionMutex); std::scoped_lock lock(mPositionMutex);
updateWorldPosition();
applyOffsetChange(); applyOffsetChange();
bool hasChanged = mPosition != position || mWorldPositionChanged; bool hasChanged = mPosition != position || mWorldPositionChanged;
mPreviousPosition = mPosition; mPreviousPosition = mPosition;

@ -55,13 +55,6 @@ namespace MWPhysics
*/ */
bool isRotationallyInvariant() const; bool isRotationallyInvariant() const;
/**
* Set mWorldPosition to the position in the Ptr's RefData. This is used by the physics simulation to account for
* when an object is "instantly" moved/teleported as opposed to being moved by the physics simulation.
*/
void updateWorldPosition();
osg::Vec3f getWorldPosition() const;
/** /**
* Used by the physics simulation to store the simulation result. Used in conjunction with mWorldPosition * Used by the physics simulation to store the simulation result. Used in conjunction with mWorldPosition
* to account for e.g. scripted movements * to account for e.g. scripted movements
@ -204,7 +197,6 @@ namespace MWPhysics
osg::Vec3f mScale; osg::Vec3f mScale;
osg::Vec3f mRenderingScale; osg::Vec3f mRenderingScale;
osg::Vec3f mWorldPosition;
osg::Vec3f mSimulationPosition; osg::Vec3f mSimulationPosition;
osg::Vec3f mPosition; osg::Vec3f mPosition;
osg::Vec3f mPreviousPosition; osg::Vec3f mPreviousPosition;

@ -938,7 +938,6 @@ namespace MWPhysics
void ActorFrameData::updatePosition(btCollisionWorld* world) void ActorFrameData::updatePosition(btCollisionWorld* world)
{ {
mActorRaw->updateWorldPosition();
mActorRaw->applyOffsetChange(); mActorRaw->applyOffsetChange();
mPosition = mActorRaw->getPosition(); mPosition = mActorRaw->getPosition();
if (mWaterCollision && mPosition.z() < mWaterlevel && canMoveToWaterSurface(mActorRaw, mWaterlevel, world)) if (mWaterCollision && mPosition.z() < mWaterlevel && canMoveToWaterSurface(mActorRaw, mWaterlevel, world))

Loading…
Cancel
Save