Jump to content

ActionManager - Is there a way to fire (simulate) event


Vousk-prod.
 Share

Recommended Posts

Interesting question, Vousk-prod!  If I may, I want to add a couple more questions for the experts...

 

The actionManager acts sort of like a patch panel. It is used to 'wire' or 'attach' a trigger... to an action.  Or in the case of using CombineAction... you can wire a trigger, to MANY actions.

 

Question #1:  For processTrigger(trigger), does the user need to create a fake trigger object... to use as the arg/parameter?  If so, can you tell us how that is done?  Thanks.

 

Question #2:  Would it be possible to do...  processAction(actionNumber).  Actions don't have names, but maybe all actions ARE... or some COULD BE... kept in an array.  Here's an example:

var actionsArray = [];actionsArray.push(new BABYLON.SetValueAction(BABYLON.ActionManager.NoneTrigger, mesh.material, "wireframe", false));actionsArray.push(new BABYLON.InterpolateValueAction(BABYLON.ActionManager.NoneTrigger, light, "diffuse", BABYLON.Color3.Black(), 1000));actionsArray.push(new BABYLON.InterpolateValueAction(BABYLON.ActionManager.NoneTrigger, camera, "alpha", 0, 500, new BABYLON.PredicateCondition(scene.actionManager, function () { return light1.diffuse.equals(BABYLON.Color3.Red(); } )));// notice that all 3 are NoneTrigger... I think that would be a requirement.scene.actionManager.processAction(actionsArray[1]);

Essentially, I was wondering if a registered action could be actuated... by calling it manually... without a trigger happening, and without creating a fake trigger.  I don't know if such a thing would ever be needed or useful.  I am just thinking of stupid stuff, here.  I know there is no .processAction function... I went looking already. :) 

 

I realize that the same thing could be done with the processTrigger function... IF the user knows how to create the correct fake trigger for its parameter.

 

I re-invite everyone to carefully read the actionManager tutorial  and play around with the actionManager playground demo.  There is a ton of things going-on in that demo.  Notice that clicking the sphere to rotate the camera to a new location... does not work if light #1 is set .diffuse black?  (toggled with a click on the red box)  Ain't that cool?  Conditions! 

 

At my request, Deltakosh added more info to the actionManager tutorial... to teach us more about conditions.  He did it well, and it helps show just how very powerful and versatile the actionManager really is.  It is an amazing device.  I would hate to meet one in a dark alley, because it would be a mighty machine... with many robotic arms, levers, knobs, pistons, actuators, wheels, and smoke stacks.  :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...