Quantcast
Viewing all articles
Browse latest Browse all 388

Fire "CombineAction" by "if" condition

Hi everyone and merry Christmas.

 

I need to play a group of animations when an "if" condition happens. I tried with this:

if(cond > 1){
    elevador.actionManager = new BABYLON.ActionManager(scene);
    elevador.actionManager.registerAction(

    new BABYLON.CombineAction(BABYLON.ActionManager.NothingTrigger, 
      [
       new BABYLON.PlayAnimationAction(BABYLON.ActionManager.NothingTrigger, elevador, 0, 288, 0),
       new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.NothingTrigger, function () {
           scene.registerBeforeRender(function () {
              if(camera.position.y < 102){
                  camera.position.y += 1;
              }
           });
       }),
       new BABYLON.PlaySoundAction(BABYLON.ActionManager.NothingTrigger, sonidoElevador)
      ])
    );
}

But this dont work. What changes can I do to achieve it?

 

Thanks.


Viewing all articles
Browse latest Browse all 388

Trending Articles