mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 18:59:57 +00:00
Apply waterwalking even when we skip simulation.
This chunk was supposed to be part of !1324 but somehow got stuck staged in my tree.
This commit is contained in:
parent
8c06558cf8
commit
8c21b0b503
3 changed files with 4 additions and 21 deletions
|
@ -123,8 +123,10 @@ namespace
|
||||||
frameData.mPosition = actor->getPosition();
|
frameData.mPosition = actor->getPosition();
|
||||||
if (frameData.mWaterCollision && frameData.mPosition.z() < frameData.mWaterlevel && actor->canMoveToWaterSurface(frameData.mWaterlevel, mCollisionWorld))
|
if (frameData.mWaterCollision && frameData.mPosition.z() < frameData.mWaterlevel && actor->canMoveToWaterSurface(frameData.mWaterlevel, mCollisionWorld))
|
||||||
{
|
{
|
||||||
frameData.mPosition.z() = frameData.mWaterlevel;
|
const auto offset = osg::Vec3f(0, 0, frameData.mWaterlevel - frameData.mPosition.z());
|
||||||
MWBase::Environment::get().getWorld()->moveObject(actor->getPtr(), frameData.mPosition, false);
|
MWBase::Environment::get().getWorld()->moveObjectBy(actor->getPtr(), offset);
|
||||||
|
actor->applyOffsetChange();
|
||||||
|
frameData.mPosition = actor->getPosition();
|
||||||
}
|
}
|
||||||
frameData.mOldHeight = frameData.mPosition.z();
|
frameData.mOldHeight = frameData.mPosition.z();
|
||||||
const auto rotation = actor->getPtr().getRefData().getPosition().asRotationVec3();
|
const auto rotation = actor->getPtr().getRefData().getPosition().asRotationVec3();
|
||||||
|
|
|
@ -945,24 +945,6 @@ namespace MWPhysics
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActorFrameData::updatePosition(Actor& actor, btCollisionWorld* world)
|
|
||||||
{
|
|
||||||
actor.applyOffsetChange();
|
|
||||||
mPosition = actor.getPosition();
|
|
||||||
if (mWaterCollision && mPosition.z() < mWaterlevel && actor.canMoveToWaterSurface(mWaterlevel, world))
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWorld()->moveObjectBy(actor.getPtr(), osg::Vec3f(0, 0, mWaterlevel - mPosition.z()));
|
|
||||||
actor.applyOffsetChange();
|
|
||||||
mPosition = actor.getPosition();
|
|
||||||
}
|
|
||||||
mOldHeight = mPosition.z();
|
|
||||||
const auto rotation = actor.getPtr().getRefData().getPosition().asRotationVec3();
|
|
||||||
mRotation = osg::Vec2f(rotation.x(), rotation.z());
|
|
||||||
mInertia = actor.getInertialForce();
|
|
||||||
mStuckFrames = actor.getStuckFrames();
|
|
||||||
mLastStuckPosition = actor.getLastStuckPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectileFrameData::ProjectileFrameData(Projectile& projectile)
|
ProjectileFrameData::ProjectileFrameData(Projectile& projectile)
|
||||||
: mPosition(projectile.getPosition())
|
: mPosition(projectile.getPosition())
|
||||||
, mMovement(projectile.velocity())
|
, mMovement(projectile.velocity())
|
||||||
|
|
|
@ -76,7 +76,6 @@ namespace MWPhysics
|
||||||
struct ActorFrameData
|
struct ActorFrameData
|
||||||
{
|
{
|
||||||
ActorFrameData(Actor& actor, bool inert, bool waterCollision, float slowFall, float waterlevel);
|
ActorFrameData(Actor& actor, bool inert, bool waterCollision, float slowFall, float waterlevel);
|
||||||
void updatePosition(Actor& actor, btCollisionWorld* world);
|
|
||||||
osg::Vec3f mPosition;
|
osg::Vec3f mPosition;
|
||||||
osg::Vec3f mInertia;
|
osg::Vec3f mInertia;
|
||||||
const btCollisionObject* mStandingOn;
|
const btCollisionObject* mStandingOn;
|
||||||
|
|
Loading…
Reference in a new issue