mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-11 09:36:37 +00:00
Only reset the animation time if a new state was set
This commit is contained in:
parent
fc0f9e2159
commit
fef6284f15
@ -187,24 +187,22 @@ float Animation::findStart(const std::string &groupname, const std::string &star
|
||||
|
||||
void Animation::play(const std::string &groupname, const std::string &start)
|
||||
{
|
||||
float time = 0.0f;
|
||||
try {
|
||||
if(!mEntityList.mSkelBase)
|
||||
throw std::runtime_error("Attempting to animate an inanimate object");
|
||||
|
||||
Ogre::AnimationState *newstate = mEntityList.mSkelBase->getAnimationState(groupname);
|
||||
if(mAnimState)
|
||||
mAnimState->setEnabled(false);
|
||||
mAnimState = mEntityList.mSkelBase->getAnimationState(groupname);
|
||||
mCurrentKeys = &mTextKeys[groupname];
|
||||
mAnimState = newstate;
|
||||
mAnimState->setEnabled(true);
|
||||
mCurrentKeys = &mTextKeys[groupname];
|
||||
|
||||
time = findStart(groupname, start);
|
||||
resetPosition(findStart(groupname, start));
|
||||
}
|
||||
catch(std::exception &e) {
|
||||
std::cerr<< e.what() <<std::endl;
|
||||
}
|
||||
|
||||
resetPosition(time);
|
||||
}
|
||||
|
||||
void Animation::runAnimation(float timepassed)
|
||||
|
Loading…
Reference in New Issue
Block a user