Bonzai Engine Forum

Bonzai Engine & Tools => Bonzai Engine on Android => Topic started by: amirr on June 04, 2013, 04:57:18 PM

Title: AnimationSplitInfo not working
Post by: amirr on June 04, 2013, 04:57:18 PM
I used the AnimationSplitInfo class but it didn't work
Here's the initialization for AnimationSplitInfo

and this function return "0" and so i can't change the animation.

So any advice ?
Title: Re: AnimationSplitInfo not working
Post by: jerome_j on June 04, 2013, 05:22:46 PM
For skeletal animation (as specified in javadoc), works as expected.
Md2 have morph animation and obviously there isn't any skeleton to split.
Title: Re: AnimationSplitInfo not working
Post by: amirr on June 04, 2013, 05:38:42 PM
So in MD2 and using morph animation, How to animate a certain number of frames and after awhile play another number of frames ?
Title: Re: AnimationSplitInfo not working
Post by: jerome_j on June 04, 2013, 05:49:10 PM
For morph animation, it's straightfoward:

Create a new Animation object and set the name, start, end, speed fields as wanted. Add the animation to the model using addAnimation. You can now play that animation when you want.
When it's complete, you can play any other Animation.

You can do all of that in the viewer from the animation tab of the model panel. There's a popup in the animation list to add/remove anims.
Title: Re: AnimationSplitInfo not working
Post by: amirr on June 05, 2013, 01:50:10 PM
I did what you had said and I've a problem.
Here's the animation sample:

Title: Re: AnimationSplitInfo not working
Post by: jerome_j on June 05, 2013, 02:04:33 PM
Start/end/loop/loopDuration units is seconds. Start/end/loop are times in the morph animation keyframe, whereas loopDuration is a duration. Speed has no unit and scale the time to play faster or slower the animation.

Start/end being the time of the first/last frame of the animation. Speed is by default 1 to play at regular speed. Loop is the loop time, the animation is rewinded to that time when it reaches end. Loop is enabled when the value is in the range [start;end[. LoopDuration is by default 0 to instantly go from end to loop, specify a duration in seconds to have a smooth interpolation between them (if needed).

You can take as reference the values from the default animation of your model, and adjust the start/end values for your new animation.