1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 07:53:52 +00:00

Return the animation movement from the character controller.

Consequently, dead actors don't move anymore. The doPhysics call apparently
isn't moving them.
This commit is contained in:
Chris Robinson 2013-01-18 17:05:58 -08:00
parent 9123f4f2af
commit 1cdd64cd9b
3 changed files with 20 additions and 16 deletions

View file

@ -120,10 +120,25 @@ void CharacterController::markerEvent(float time, const std::string &evt)
Ogre::Vector3 CharacterController::update(float duration)
{
Ogre::Vector3 movement = Ogre::Vector3::ZERO;
if(mAnimation && !mSkipAnim)
mAnimation->runAnimation(duration);
movement += mAnimation->runAnimation(duration);
mSkipAnim = false;
return mDirection;
if(getState() == CharState_SpecialIdle || getState() == CharState_Idle ||
getState() == CharState_Dead)
{
// FIXME: mDirection shouldn't influence the movement here.
movement += mDirection;
}
else
{
// FIXME: mDirection should be normalized after setting the speed of
// the animation in setDirection, rather than here.
movement = mDirection.normalisedCopy() * movement.length();
}
return movement;
}

View file

@ -140,16 +140,6 @@ Ogre::Vector3 Animation::updatePosition(float time)
/* Translate the accumulation root back to compensate for the move. */
mAccumRoot->translate(-posdiff);
mLastPosition += posdiff;
if(mPtr.isInCell())
{
/* Finally, move the object based on how much the non-accumulation root moved. */
Ogre::Vector3 newpos(mPtr.getRefData().getPosition().pos);
newpos += mInsert->getOrientation() * posdiff;
MWBase::World *world = MWBase::Environment::get().getWorld();
world->moveObject(mPtr, newpos.x, newpos.y, newpos.z);
}
}
return posdiff;
}

View file

@ -32,11 +32,10 @@ protected:
NifOgre::TextKeyMap::const_iterator mNextKey;
Ogre::AnimationState *mAnimState;
/* Updates the animation to the specified time, and moves the mPtr object
* based on the change since the last update or reset. */
/* Updates the animation to the specified time, and returns the movement
* vector since the last update or reset. */
Ogre::Vector3 updatePosition(float time);
/* Updates the animation to the specified time, without moving the mPtr
* object. */
/* Updates the animation to the specified time, without moving anything. */
void resetPosition(float time);
float findStart(const std::string &groupname, const std::string &start);