Im having trouble with animation using vertex animator on MD2 parsed model.
What i do is create 2 VertexClipNodes that i add the animation frames to, add them to the VertexAnimationSet and then instantiate the VertexAnimator with that VertexAnimationSet.
The animations i am using are exact opposites of each other, page curl up, and page curl down.
The problem I am having is that when i use VertexAnimator(_animator).play(“nameOfAnimation”, null, 0) the first frame i see mesh being quickly repositioned to the initial state, and then the animation played. Its looks like it starts from the last frame, and then next frame is first frame and then it plays normal.
So when i play “pageCurlUp” first time its ok.
Second time, i see reseting to initial state, and then animation played.
But, when i pageCurlUp, and THEN pageCurlDown, i dont see reseting because mesh was already in a state that was the first frame of pageCurlDown animation. (Because first frame of pageCurlDown is last frame of PageCurlUp)
I hope you got my point.
Can someone please point me in the right direction? How do i reset the mesh with a vertexAnimator to the initial state BEFORE i start the animation?
Here is some code:
Creating animator
_animator = new PageFlipAnimator(_animationSet);
_mesh.animator = _animator;
Creating animation node:
var frameDuration:Number = 166;
var _reverseClipNode:VertexClipNode = new VertexClipNode();
_reverseClipNode.name = "reverse";
for (var i:int = _clipNode.frames.length-1; i >= 0 ; i--) {
_reverseClipNode.addFrame(_clipNode.frames[i],frameDuration);
}
_animationSet.addAnimation(_reverseClipNode);
Playing animation:
_animator.play("reverse", null, 0);
Before that, i am parsing the MD2 file