I’m having an issue with attempting to deliberately repeat a non-looping animation (via animationcontroller)
I should mention that I am doing so in the FixedUpdate physics pre-step handler, though I doubt that is relevant.
The Urho docs mention that non-looping animations don’t stop by themselves - what happens is that they pause at the last animation keyframe, and the animated character remains in that pose.
That’s fine, so I figured that if I called Stop on that animation, then I should be able to immediately thereafter call Play on it, but my animation remains in the final pose. I even tried setting the animation’s time to zero, still no dice.
/// Character is Grounded, and the Jump Key is being pressed!
ifkey(CTRL_JUMP){
/// PHYSICS:
/// Jump, Homer, Jump!
bulletController_->jump(btVector3(0, 6, 0));
/// ANIMATION:
/// If we're already Jumping (i.e. user held down Jump Key while Landing from a previous Jump ...)
if(isJumping_){
/// Try to "forcedly repeat" a non-looping animation (this does not work)
// animCtrl->RemoveAnimationState(animCtrl->GetAnimationState(Animations_[Animations_Player::Jump].Name));
// animCtrl->Stop(Animations_[Animations_Player::Jump].Name, 0);
animCtrl->PlayExclusive(Animations_[Animations_Player::Jump].Name, 0, false, 0);
}else{
/// Transition to the Jump Animation
animCtrl->PlayExclusive(Animations_[Animations_Player::Jump].Name, 0, false, 0.2f);
/// Try to auto-remove animationstate from controller on completion (this does not work either)
animCtrl->SetRemoveOnCompletion(Animations_[Animations_Player::Jump].Name, true);
}
/// Character is Jumping, until it touches the ground again
isJumping_=true;
}
Has anyone ever needed to repeat a non-looping animation, without changing to another animation first? How did you reset the state of the animation in question?
SetTime does not work. Stop, and SetAutoFade, as hinted by the docs, are also not able to reset a sole animation played as non looping, to deliberately replay it.