Hi,
I am somehow stuggleing on how to playback animation:
Let's say I have a non looping attack animation, and a looping idle animation.
Messing around with your Viewer app, I can seem to get it work:
In LoadAnimations I do
if( instances_[ix].Name.Contains( "attack" ) )
{
instances_[ix].Looping = false;
}
And then in Update:
if( KeyPressed( Keys.O ) )
{
instances_[6].Time = 0.0f;
blender_.AddAnimation( blended_[6], 1.0f );
}
Note: instances_[6] is my attack animation.
Now the first time, it plays the attack animation.
If I press O as long as the attack animation is playing, it restarts the animation.
If I press O after the animation has finished, nothing happens.
Do you have a clue what's wrong here?
I've tried a lot of things (Reset() and so on) but nothing seemed to work out.
This is sort of just a basic test, what I actually want to achieve is to then blend (transition) the non looping attack animation into the looping idle, as soon as attack is finished (currently it's a hard-cut).
Thanks!
Christian
Is blended_ a set of blended
Is blended_ a set of blended or composed animations?
Anyway, I don't see you remove any of the animations when they are complete. Try adding blended_[6].Remove() before you set the time to 0 when you want to play a new instance of it. Else you'll probably keep accumulating animation instances for a long time...
Perhaps it's a weakness that Complete animations aren't removed from the animation blender automatically. I think there was a reason why I didn't do that, but I can't remember it now.
I tried it, but unfortuneatly
I tried it, but unfortuneatly with no positive result: still nothing moving after one loop has finished.
I also looked at the size of blendedAnimations_ of the AnimationBlender, it's 0 until I press O the first time, and it always remains one as soon as I pressed O.
It doesnt matter if I use the blended_[6].Remove(); regarding this size.
Maybe that helps you somehow? =D
Any other suggestions?
I'm out of ideas at that
I'm out of ideas at that point. I think you'll have to get down and dirty with the debugger and figure out what's supposed to happen, and what does happen. Perhaps start by putting a breakpoint where you call Remove() on the blended animation, and step through that function; then step through the AddAnimation() and see what happens. Then put a breakpoint into Update() and see what's going on inside the Update() call.
Ok, I'll give it a shot as
Ok, I'll give it a shot as soon as possible! (and post the result of course)
Does this mean that for your needs you havent used a "single-shot" animation yet?