away3d / away3d-core-fp11

Away3D engine for Flash Player 11
http://www.away3d.com
Other
639 stars 274 forks source link

Skeleton animation looping does not work properly and does not throw any exceptions #690

Open SirGordon opened 10 years ago

SirGordon commented 10 years ago

Hello! I have converted a free model to AWD, here is it's link: http://r.playerio.com/r/moba-zpuzrjgvp0pk6vq9l6mfq/mage/mage.awd and tried to animate it in my project.

  1. When i set looping to "false" in "die" animation clip when the model loads, and after some time i try to play() the clip, the model disappears from the stage.
  2. When i set looping to false in the same animation just after calling play() method, Away3D instantly forwards the animation to the last frame, or near the last frame, without actually animating. Using Away3D 4.1.6 (swc from site).
  3. Also, i found that CYCLE_COMPLETE event is NOT synchronized with actual animation, and is often dispatched when the animation is playing in the middle, or even after the animation started to play again. I can add additional info if needed.
80prozent commented 10 years ago

Hey SirGordon

In AwayBuilder your animation works (i just checked). So it has to be the difference between AwayBuilder and Away3d-engine that is causing the problems.

about 1: Between animation in AwayBuilder and the Away3d-engine, there is this "big" difference:

AwayBuilder allways sets the "updatePosition" of the animator to false. animator.updatePosition = false;

this will have the effect, that the transformation (position) of the root-joint will not be considered. So no matter what scene-position you skeleton has set, it will allways be set to pos 0,0,0 rot 0,0,0.

So i think when the mesh disapears in the engine, its becasue of the default for updatePosition is true, and so the position of the rootjoint is considered, and therefore the mesh might be just out of your cameras view.

about 2:

each animationclip has a property called "stitchfinalframe" this is not available in awayBuilder atm (and therefore always set to false). finalStitch=true will replace the last keyframe with the first one. (as means to get a clean looping animation...) so if somehow you have set finalStitch=true on your animClips, it could be that the clip only consisted out of 2 keyframes. if you replace keyframe 2 with 1, it leaves you with no visible animation...it still plays the duration, but both poses are the same... maybe thats whats happening here ?

about 3: sorry, i didnt worked on/with the AnimEvents yet (CYCLE_COMPLETE). Maybe this the bug that is causing the AwayBuilder timeline for AnimationClips, not to work correctly.

Hope this is of any help

SirGordon commented 10 years ago

Hello, 80prozent! Yes, the animation works, but there are issues with looping=false..

about 1: Thank you, I'll try that!

about 2: I do not set finalStitch property

about 3: I think this may be because i change the skeletonAnimator.playbackSpeed programmatically and this property is not taken into the account

SirGordon commented 10 years ago

I confirm, animator.updatePosition = false; fixes the disappearing object problem. But i still wonder, why does the problem arise only if SkeletonClipNode.looping = false, because when it is true, object's coordinates are not modified!