Merge branch 'actually_walk_on_the_water' into 'master'

#6373: finish half commited commit

See merge request OpenMW/openmw!1336
pull/3212/head
psi29a 3 years ago
commit 9694398b69

@ -123,8 +123,10 @@ namespace
frameData.mPosition = actor->getPosition();
if (frameData.mWaterCollision && frameData.mPosition.z() < frameData.mWaterlevel && actor->canMoveToWaterSurface(frameData.mWaterlevel, mCollisionWorld))
{
frameData.mPosition.z() = frameData.mWaterlevel;
MWBase::Environment::get().getWorld()->moveObject(actor->getPtr(), frameData.mPosition, false);
const auto offset = osg::Vec3f(0, 0, frameData.mWaterlevel - frameData.mPosition.z());
MWBase::Environment::get().getWorld()->moveObjectBy(actor->getPtr(), offset);
actor->applyOffsetChange();
frameData.mPosition = actor->getPosition();
}
frameData.mOldHeight = frameData.mPosition.z();
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)
: mPosition(projectile.getPosition())
, mMovement(projectile.velocity())

@ -76,7 +76,6 @@ namespace MWPhysics
struct ActorFrameData
{
ActorFrameData(Actor& actor, bool inert, bool waterCollision, float slowFall, float waterlevel);
void updatePosition(Actor& actor, btCollisionWorld* world);
osg::Vec3f mPosition;
osg::Vec3f mInertia;
const btCollisionObject* mStandingOn;

Loading…
Cancel
Save