mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-04 05:45:35 +00:00
Merge branch 'fix_the_fix's_fix' into 'master'
Don't fall while teleporting See merge request OpenMW/openmw!411
This commit is contained in:
commit
894bcb8bcc
4 changed files with 17 additions and 16 deletions
|
@ -74,11 +74,8 @@ Actor::Actor(const MWWorld::Ptr& ptr, const Resource::BulletShape* shape, Physic
|
||||||
|
|
||||||
updateRotation();
|
updateRotation();
|
||||||
updateScale();
|
updateScale();
|
||||||
updatePosition();
|
resetPosition();
|
||||||
setPosition(mWorldPosition, true);
|
|
||||||
|
|
||||||
addCollisionMask(getCollisionMask());
|
addCollisionMask(getCollisionMask());
|
||||||
updateCollisionObjectPosition();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Actor::~Actor()
|
Actor::~Actor()
|
||||||
|
@ -160,15 +157,9 @@ osg::Vec3f Actor::getCollisionObjectPosition() const
|
||||||
return Misc::Convert::toOsg(mLocalTransform.getOrigin());
|
return Misc::Convert::toOsg(mLocalTransform.getOrigin());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::setPosition(const osg::Vec3f& position, bool reset)
|
void Actor::setPosition(const osg::Vec3f& position)
|
||||||
{
|
{
|
||||||
if (reset)
|
mPreviousPosition = mPosition;
|
||||||
{
|
|
||||||
mPreviousPosition = position;
|
|
||||||
mNextPosition = position;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
mPreviousPosition = mPosition;
|
|
||||||
mPosition = position;
|
mPosition = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,6 +169,15 @@ void Actor::adjustPosition(const osg::Vec3f& offset)
|
||||||
mPreviousPosition += offset;
|
mPreviousPosition += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Actor::resetPosition()
|
||||||
|
{
|
||||||
|
updatePosition();
|
||||||
|
mPreviousPosition = mWorldPosition;
|
||||||
|
mPosition = mWorldPosition;
|
||||||
|
mNextPosition = mWorldPosition;
|
||||||
|
updateCollisionObjectPosition();
|
||||||
|
}
|
||||||
|
|
||||||
osg::Vec3f Actor::getPosition() const
|
osg::Vec3f Actor::getPosition() const
|
||||||
{
|
{
|
||||||
return mPosition;
|
return mPosition;
|
||||||
|
|
|
@ -91,7 +91,8 @@ namespace MWPhysics
|
||||||
/**
|
/**
|
||||||
* Store the current position into mPreviousPosition, then move to this position.
|
* Store the current position into mPreviousPosition, then move to this position.
|
||||||
*/
|
*/
|
||||||
void setPosition(const osg::Vec3f& position, bool reset=false);
|
void setPosition(const osg::Vec3f& position);
|
||||||
|
void resetPosition();
|
||||||
void adjustPosition(const osg::Vec3f& offset);
|
void adjustPosition(const osg::Vec3f& offset);
|
||||||
|
|
||||||
osg::Vec3f getPosition() const;
|
osg::Vec3f getPosition() const;
|
||||||
|
|
|
@ -253,7 +253,7 @@ namespace MWPhysics
|
||||||
for (const auto& m : mActorsFrameData)
|
for (const auto& m : mActorsFrameData)
|
||||||
{
|
{
|
||||||
m.mActorRaw->setStandingOnPtr(nullptr);
|
m.mActorRaw->setStandingOnPtr(nullptr);
|
||||||
m.mActorRaw->setPosition(m.mActorRaw->getWorldPosition(), true);
|
m.mActorRaw->resetPosition();
|
||||||
mMovementResults[m.mPtr] = m.mActorRaw->getWorldPosition();
|
mMovementResults[m.mPtr] = m.mActorRaw->getWorldPosition();
|
||||||
}
|
}
|
||||||
return mMovementResults;
|
return mMovementResults;
|
||||||
|
|
|
@ -433,8 +433,8 @@ namespace MWPhysics
|
||||||
ActorMap::iterator found = mActors.find(ptr);
|
ActorMap::iterator found = mActors.find(ptr);
|
||||||
if (found == mActors.end())
|
if (found == mActors.end())
|
||||||
return ptr.getRefData().getPosition().asVec3();
|
return ptr.getRefData().getPosition().asVec3();
|
||||||
else
|
found->second->resetPosition();
|
||||||
return MovementSolver::traceDown(ptr, position, found->second.get(), mCollisionWorld.get(), maxHeight);
|
return MovementSolver::traceDown(ptr, position, found->second.get(), mCollisionWorld.get(), maxHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsSystem::addHeightField (const float* heights, int x, int y, float triSize, float sqrtVerts, float minH, float maxH, const osg::Object* holdObject)
|
void PhysicsSystem::addHeightField (const float* heights, int x, int y, float triSize, float sqrtVerts, float minH, float maxH, const osg::Object* holdObject)
|
||||||
|
|
Loading…
Reference in a new issue