forked from mirror/openmw-tes3mp
Improve resetting the animation position
This commit is contained in:
parent
14d814d1d3
commit
5f668976a8
2 changed files with 5 additions and 4 deletions
|
@ -21,6 +21,7 @@ Animation::Animation(const MWWorld::Ptr &ptr)
|
|||
, mSkipFrame(false)
|
||||
, mAccumRoot(NULL)
|
||||
, mNonAccumRoot(NULL)
|
||||
, mStartPosition(0.0f)
|
||||
, mLastPosition(0.0f)
|
||||
{
|
||||
mCurGroup.mStart = mCurGroup.mLoopStart = 0.0f;
|
||||
|
@ -76,7 +77,8 @@ void Animation::createEntityList(Ogre::SceneNode *node, const std::string &model
|
|||
mAccumRoot = skelinst->getRootBone();
|
||||
mAccumRoot->setManuallyControlled(true);
|
||||
mNonAccumRoot = skelinst->getBone(bone->getHandle());
|
||||
mLastPosition = mNonAccumRoot->getPosition();
|
||||
mStartPosition = mNonAccumRoot->getPosition();
|
||||
mLastPosition = mStartPosition;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -117,9 +119,7 @@ void Animation::resetPosition(float time)
|
|||
{
|
||||
mEntityList.mSkelBase->getSkeleton()->setAnimationState(*mAnimState->getParent());
|
||||
mLastPosition = mNonAccumRoot->getPosition();
|
||||
/* FIXME: This should be set to -mLastPosition, but without proper collision the
|
||||
* model gets placed halfway into the ground. */
|
||||
mAccumRoot->setPosition(0.0f, 0.0f, 0.0f);
|
||||
mAccumRoot->setPosition(mStartPosition - mLastPosition);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ protected:
|
|||
NifOgre::TextKeyMap mTextKeys;
|
||||
Ogre::Bone *mAccumRoot;
|
||||
Ogre::Bone *mNonAccumRoot;
|
||||
Ogre::Vector3 mStartPosition;
|
||||
Ogre::Vector3 mLastPosition;
|
||||
|
||||
/* Updates the animation to the specified time, and moves the mPtr object
|
||||
|
|
Loading…
Reference in a new issue