forked from teamnwah/openmw-tes3coop
Revert "Merge pull request #1701 from akortunov/standfix"
This reverts commitda47fc79f5
, reversing changes made to7324bd368f
.
This commit is contained in:
parent
b151a89528
commit
99ffaafe30
11 changed files with 8 additions and 63 deletions
|
@ -391,7 +391,6 @@ namespace MWBase
|
|||
virtual bool isUnderwater(const MWWorld::ConstPtr &object, const float heightRatio) const = 0;
|
||||
virtual bool isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const = 0;
|
||||
virtual bool isOnGround(const MWWorld::Ptr &ptr) const = 0;
|
||||
virtual bool isIdle(const MWWorld::Ptr &ptr) const = 0;
|
||||
|
||||
virtual osg::Matrixf getActorHeadTransform(const MWWorld::ConstPtr& actor) const = 0;
|
||||
|
||||
|
|
|
@ -866,7 +866,8 @@ namespace MWMechanics
|
|||
}
|
||||
|
||||
// place above to prevent moving inside objects, e.g. stairs, because a vector between pathgrids can be underground.
|
||||
dest.mZ += 80;
|
||||
// Adding 20 in adjustPosition() is not enough.
|
||||
dest.mZ += 60;
|
||||
|
||||
ToWorldCoordinates(dest, actor.getCell()->getCell());
|
||||
|
||||
|
|
|
@ -2036,8 +2036,7 @@ void CharacterController::update(float duration)
|
|||
moved.z() = 1.0;
|
||||
|
||||
// Update movement
|
||||
// We should not apply movement for standing actors
|
||||
if(mMovementAnimationControlled && mPtr.getClass().isActor() && (movement.length2() > 0.f || !world->isIdle(mPtr)))
|
||||
if(mMovementAnimationControlled && mPtr.getClass().isActor())
|
||||
world->queueMovement(mPtr, moved);
|
||||
|
||||
mSkipAnim = false;
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace MWPhysics
|
|||
|
||||
Actor::Actor(const MWWorld::Ptr& ptr, osg::ref_ptr<const Resource::BulletShape> shape, btCollisionWorld* world)
|
||||
: mCanWaterWalk(false), mWalkingOnWater(false)
|
||||
, mCollisionObject(nullptr), mForce(0.f, 0.f, 0.f), mOnGround(true), mOnSlope(false), mIdle(true)
|
||||
, mCollisionObject(nullptr), mForce(0.f, 0.f, 0.f), mOnGround(true), mOnSlope(false)
|
||||
, mInternalCollisionMode(true)
|
||||
, mExternalCollisionMode(true)
|
||||
, mCollisionWorld(world)
|
||||
|
@ -195,11 +195,6 @@ void Actor::setOnSlope(bool slope)
|
|||
mOnSlope = slope;
|
||||
}
|
||||
|
||||
void Actor::setIdle(bool idle)
|
||||
{
|
||||
mIdle = idle;
|
||||
}
|
||||
|
||||
bool Actor::isWalkingOnWater() const
|
||||
{
|
||||
return mWalkingOnWater;
|
||||
|
|
|
@ -139,13 +139,6 @@ namespace MWPhysics
|
|||
return mInternalCollisionMode && mOnSlope;
|
||||
}
|
||||
|
||||
void setIdle(bool idle);
|
||||
|
||||
bool getIdle() const
|
||||
{
|
||||
return mIdle;
|
||||
}
|
||||
|
||||
btCollisionObject* getCollisionObject() const
|
||||
{
|
||||
return mCollisionObject.get();
|
||||
|
@ -186,7 +179,6 @@ namespace MWPhysics
|
|||
osg::Vec3f mForce;
|
||||
bool mOnGround;
|
||||
bool mOnSlope;
|
||||
bool mIdle;
|
||||
bool mInternalCollisionMode;
|
||||
bool mExternalCollisionMode;
|
||||
|
||||
|
|
|
@ -249,7 +249,7 @@ namespace MWPhysics
|
|||
// Check if we actually found a valid spawn point (use an infinitely thin ray this time).
|
||||
// Required for some broken door destinations in Morrowind.esm, where the spawn point
|
||||
// intersects with other geometry if the actor's base is taken into account
|
||||
btVector3 from = toBullet(position + offset);
|
||||
btVector3 from = toBullet(position);
|
||||
btVector3 to = from - btVector3(0,0,maxHeight);
|
||||
|
||||
btCollisionWorld::ClosestRayResultCallback resultCallback1(from, to);
|
||||
|
@ -683,7 +683,6 @@ namespace MWPhysics
|
|||
, mWaterEnabled(false)
|
||||
, mParentNode(parentNode)
|
||||
, mPhysicsDt(1.f / 60.f)
|
||||
, mIdleUpdateTimer(0)
|
||||
{
|
||||
mResourceSystem->addResourceManager(mShapeManager.get());
|
||||
|
||||
|
@ -740,18 +739,6 @@ namespace MWPhysics
|
|||
delete mBroadphase;
|
||||
}
|
||||
|
||||
void PhysicsSystem::updateIdle()
|
||||
{
|
||||
for (ActorMap::iterator it = mActors.begin(); it != mActors.end(); ++it)
|
||||
{
|
||||
osg::Vec3f pos(it->second->getCollisionObjectPosition());
|
||||
|
||||
RayResult result = castRay(pos, pos - osg::Vec3f(0, 0, it->second->getHalfExtents().z() + 2), it->second->getPtr(), std::vector<MWWorld::Ptr>(), CollisionType_World|CollisionType_HeightMap|CollisionType_Door);
|
||||
|
||||
it->second->setIdle(result.mHit);
|
||||
}
|
||||
}
|
||||
|
||||
void PhysicsSystem::setUnrefQueue(SceneUtil::UnrefQueue *unrefQueue)
|
||||
{
|
||||
mUnrefQueue = unrefQueue;
|
||||
|
@ -1058,11 +1045,6 @@ namespace MWPhysics
|
|||
return physactor && physactor->getOnGround();
|
||||
}
|
||||
|
||||
bool PhysicsSystem::isIdle(const MWWorld::Ptr &actor)
|
||||
{
|
||||
Actor* physactor = getActor(actor);
|
||||
return physactor && physactor->getIdle();
|
||||
}
|
||||
bool PhysicsSystem::canMoveToWaterSurface(const MWWorld::ConstPtr &actor, const float waterlevel)
|
||||
{
|
||||
const Actor* physicActor = getActor(actor);
|
||||
|
@ -1355,10 +1337,6 @@ namespace MWPhysics
|
|||
cmode = !cmode;
|
||||
found->second->enableCollisionMode(cmode);
|
||||
found->second->enableCollisionBody(cmode);
|
||||
|
||||
if (cmode)
|
||||
queueObjectMovement(MWMechanics::getPlayer(), osg::Vec3f(0, 0, -0.1f));
|
||||
|
||||
return cmode;
|
||||
}
|
||||
|
||||
|
@ -1478,13 +1456,6 @@ namespace MWPhysics
|
|||
for (std::set<Object*>::iterator it = mAnimatedObjects.begin(); it != mAnimatedObjects.end(); ++it)
|
||||
(*it)->animateCollisionShapes(mCollisionWorld);
|
||||
|
||||
mIdleUpdateTimer -= dt;
|
||||
if (mIdleUpdateTimer <= 0.f)
|
||||
{
|
||||
mIdleUpdateTimer = 0.5f;
|
||||
updateIdle();
|
||||
}
|
||||
|
||||
#ifndef BT_NO_PROFILE
|
||||
CProfileManager::Reset();
|
||||
CProfileManager::Increment_Frame_Counter();
|
||||
|
|
|
@ -124,7 +124,6 @@ namespace MWPhysics
|
|||
bool getLineOfSight(const MWWorld::ConstPtr& actor1, const MWWorld::ConstPtr& actor2) const;
|
||||
|
||||
bool isOnGround (const MWWorld::Ptr& actor);
|
||||
bool isIdle (const MWWorld::Ptr& actor);
|
||||
|
||||
bool canMoveToWaterSurface (const MWWorld::ConstPtr &actor, const float waterlevel);
|
||||
|
||||
|
@ -174,7 +173,6 @@ namespace MWPhysics
|
|||
private:
|
||||
|
||||
void updateWater();
|
||||
void updateIdle();
|
||||
|
||||
osg::ref_ptr<SceneUtil::UnrefQueue> mUnrefQueue;
|
||||
|
||||
|
@ -223,7 +221,6 @@ namespace MWPhysics
|
|||
osg::ref_ptr<osg::Group> mParentNode;
|
||||
|
||||
float mPhysicsDt;
|
||||
float mIdleUpdateTimer;
|
||||
|
||||
PhysicsSystem (const PhysicsSystem&);
|
||||
PhysicsSystem& operator= (const PhysicsSystem&);
|
||||
|
|
|
@ -701,8 +701,6 @@ namespace MWScript
|
|||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
MWBase::Environment::get().getWorld()->queueMovement(ptr, osg::Vec3f(0, 0, -0.1f));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -506,7 +506,7 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
|||
if (firstPersonCam != MWBase::Environment::get().getWorld()->isFirstPerson())
|
||||
MWBase::Environment::get().getWorld()->togglePOV();
|
||||
|
||||
const MWWorld::Ptr ptr = MWMechanics::getPlayer();
|
||||
MWWorld::ConstPtr ptr = MWMechanics::getPlayer();
|
||||
|
||||
if (ptr.isInCell())
|
||||
{
|
||||
|
@ -538,9 +538,6 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
|||
// Since we passed "changeEvent=false" to changeCell, we shouldn't have triggered the cell change flag.
|
||||
// But make sure the flag is cleared anyway in case it was set from an earlier game.
|
||||
MWBase::Environment::get().getWorld()->markCellAsUnchanged();
|
||||
|
||||
// Workaround to fix camera position upon game load
|
||||
MWBase::Environment::get().getWorld()->queueMovement(ptr, osg::Vec3f(0, 0, 0));
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
|
|
|
@ -1314,6 +1314,8 @@ namespace MWWorld
|
|||
if (pos.z() < terrainHeight)
|
||||
pos.z() = terrainHeight;
|
||||
|
||||
pos.z() += 20; // place slightly above. will snap down to ground with code below
|
||||
|
||||
if (force || !isFlying(ptr))
|
||||
{
|
||||
osg::Vec3f traced = mPhysics->traceDown(ptr, pos, 500);
|
||||
|
@ -2160,11 +2162,6 @@ namespace MWWorld
|
|||
return mPhysics->isOnGround(ptr);
|
||||
}
|
||||
|
||||
bool World::isIdle(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
return mPhysics->isIdle(ptr);
|
||||
}
|
||||
|
||||
void World::togglePOV()
|
||||
{
|
||||
mRendering->togglePOV();
|
||||
|
|
|
@ -489,7 +489,6 @@ namespace MWWorld
|
|||
bool isWading(const MWWorld::ConstPtr &object) const override;
|
||||
bool isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const override;
|
||||
bool isOnGround(const MWWorld::Ptr &ptr) const override;
|
||||
bool isIdle(const MWWorld::Ptr &ptr) const override;
|
||||
|
||||
osg::Matrixf getActorHeadTransform(const MWWorld::ConstPtr& actor) const override;
|
||||
|
||||
|
|
Loading…
Reference in a new issue