1 Reply Latest reply on Nov 26, 2011 8:44 PM by Dee McDee

    BonesPlayer.queue play loop continuously

    fearless0ul

      Part code like this

      repeat with i=1 to 4   

           scene.model("wnpc").bonesPlayer.queue(dance[i], 0, 0, -1, 1, 0)    

        end repeat

      Every motion play once in sequence,when the last motion play finished,the animation will stop.

      But I want the animation go on play from the first motion,loop continuously

      I can remove all motions,then add motions again,it is troublesome.

      Any better idea for this?

        • 1. Re: BonesPlayer.queue play loop continuously
          Dee McDee Level 2

          I would set up a callback so that there are always two animations on the playlist (i.e. the current animation and the next animation):

           

          property pNextAnim

           

          on beginSprite

           

            pNextAnim = 4

           

            scene.model("wnpc").bonesPlayer.queue(dance[1], 0, 0, -1, 1, 0) 

            scene.model("wnpc").bonesPlayer.queue(dance[2], 0, 0, -1, 1, 0) 

            scene.model("wnpc").bonesPlayer.queue(dance[3], 0, 0, -1, 1, 0) 

            scene.model("wnpc").registerScript(#animationEnded, #queueAnim, me)

           

          end beginSprite

           

          on queueAnim(me, tEvent, tModelName, tCurrentTime)

           

            scene.model("wnpc").bonesPlayer.queue(dance[pNextAnim], 0, 0, -1, 1, 0)

           

            pNextAnim = pNextAnim + 1

            if pNextAnim = 5 then

              pNextAnim = 1

            end if

           

          end queueAnim