Search the Community

Showing results for tags 'actionmanager'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 21 results

  1. Hello and <ping> Q: about Touch.... Getting an Offset of the Pointer on the lower right: The grey dot draws the blue line at offset upper left. Reproduced using Chrome in the Chrome Emulator. But first experienced it in a site using BJS 3.0 with both Hand and then PEP - on a Google Pixel. Replicated in a local sandbox, I'll build a playground... It uses this code: scene.onPointerObservable.add(function(){ console.log('movin') },BABYLON.PointerEventTypes.POINTERMOVE); //TODO - initPickEvents = function // ----------------------------------------------------Register Pointer Events. var meshes = centerTiles; //TODO rename tiles and move up with other code. for(var i = 0; i < meshes.length; i++){ mesh = meshes[i]; mesh.actionManager = new BABYLON.ActionManager(scene); // trigger actions mesh.actionManager.registerAction( new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickDownTrigger, function(){ // debugger; console.log('DOWN') }) ); mesh.actionManager.registerAction( new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickUpTrigger, function(){ console.log('UP') // debugger; }) ); } with this: <canvas id="renderCanvas" touch-action:"none"></canvas> Any tip on things to try? : ) SOLUTION: gotta use meta tag to set device-width. Zing.
  2. Hey guys, is it possible to select a sprite (via actionManager or scene.pickSprite, whatever) so the sprite transparency is taken into account? For example, in this playground the sprite is a circle: , but it is clickable on the invisible corners of the square image. Is there any way to avoid that? Thanks,
  3. Hello, I have a mesh that is clickable and i would like to prevent it being clicked if there is a GUI element in front of it. Playground: In this example i made the GUI clickable as well, but i would like the GUI to stop mesh from being clicked even if there wasn't click function assigned to it. Is this possible? I can almost do this with my own input handler, but it only works like 90% of the time. And it's a bit funky involving global cooldown on clicks. It also requires me assigning an empty click function to the GUI.
  4. Hi everybody: I need to know about what is the preferred approach to handle the mouse/touch events (for example onclick): (1) via the canvas by means of myCanvas.addEventListener("pointerdown", function (evt) { ... var pickInfo=myScene.pick(myScene.pointerX,myScene.pointerY,function(mesh){ return (mesh===myMesh); }); if(pickInfo.hit){ alert("Mesh picked"); } }); (2) via the mesh using the powerful ActionManager functionality myMesh.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickDownTrigger,function(evt){ alert("Mesh picked"); })); Thank you for your time.
  5. Hi, Don't know if this is intended behavior but ActionManager executes actions on disabled meshes too. Don't want it run on disabled meshes. Also actions registered with a parent mesh are not executed by children. Got children to execute parent action by registering action to each end child. For meshes disposed/created actionManager to toggle action execution when they are disabled/enabled. So found a way around both, if anyone is looking for it. If there is a better way, please tell. Would love to see ActionManager handle this internally. Thankyou And yeah pg:
  6. Hi guys, I'm having a hard time figuring out how to move a given object to the destination of a clicked mesh. Playground link (similar recreated scenario): As you can see, the first two actions (hovering mouse in/out effect) work fine with every tile, but the animating action seems to always extract the position of the last added tile. I'm suspecting it's because I'm overwriting the tile variable (and thus its position values) or something. I also suspect that using instances for the tiles might be a better option, since in the game they also just use 5 different materials that are loaded before-hand...but first things first. Thanks in advance for taking a look!
  7. Hello, I find that the Observable class is useful to handle events. However the ActionManager class offers more types of events such as long press for instance but we can only use it on meshes. I would like to know the fundamental difference between these two classes. Does one depend on the other ? How can I reproduce the events from ActionManager for the Observable ? Thanks
  8. Hi everyone, I am pretty new with babylon.js and have a question about the ActionManager.OnIntersectionEnterTrigger. Is it possible to use this trigger with Rectangle2D in a ScreenSpaceCanvas2D? So what I want to do is to move 2D objects in a ScreenSpaceCanvas2D and trigger a event if two of them overlap on each other. I have already tried several thing but it doesn't seems to work.. Thanks for any feedback
  9. Hi Is there any sample for dragging and collision detection implemented by actions (new features in v2.4) . my scenario : i have 3 ball(mesh) and 6 placeholder(mesh) on a board(mesh) . i want to drag balls via touch or multi touch to any placeholder on board . i read and implement , its good but i want to use actions and triggers (ActionManager) for pick up/down/move and collision detection. Thanks .
  10. Actions

    PLAYGROUND : PROBLEM: Clicking on GREY boxes displays wrong message. Should work the same as clicking on RED boxes. MORE INFO: One function is creating elements from predefined array. Second function is dynamically creating elements using FOR loop and I don't quite understand why it is not working properly. As you can see on the playground: clicking on RED boxes works just fine. The browser correctly displays clicked box's index. However, clicking on GREY boxes always displays the same message. Thank you for reading, Saafine
  11. Hello I got a 3dModel of an elevator. I trigger a button for it's position with the following code: myMesh.actionManager.registerAction(new BABYLON.InterpolateValueAction(BABYLON.ActionManager.OnPickTrigger, myMesh,"position.y",-2.6, 1000)) //down .then(new BABYLON.InterpolateValueAction(BABYLON.ActionManager.OnPickTrigger, myMesh,"position.y",0.001, 1000)); //up Witch works great! Accept when my char wants to get up again, he is falling through the ground, - the mesh. Few workarounds that come into my head, like check the state of the "event" an apply new gravity or new cam position. What's the easiest one? Any suggestions are highly appreciated! Best
  12. Hi guys, Trying to get action manager to work with multiple view ports. I am having an issue, that seems to be closely related to this question asked almost 2 years ago. ( Take a look at my playground: You will see what i am trying to do. Get the actionmanger to fire when mouse moves over the sphere. Code works well if you get rid of view ports. It doesn't work on its own (the hit test is far off in the distance) I have put an option2 in there, that works great. But it registers a camera to a pick test every frame. And this is my problem. Constantly running a registerBeforeRender pick test on an object every frame for what could be over 100 different objects in my application. This seems less than optimal. Or does actionmanager just basically run every frame as well so there is 0 difference in speed/resources? Regardless, I would still like to use actionmanager as its cleaner code, and on top of that it is simple to remove the actionmanager by just removing an object, rather than having to unregisterBeforeRender every object when it is removed. Thoughts? Thanks!
  13. Hello, I'm using a ActionManager.OnPickUpTrigger to trigger a translation of an object. It works well, and was surprisingly easy to setup. But I have a problem : actions are triggered even if the object is hidden behind another one. You can check it on this babylon playground : If you click on a target through the moving torus, the target is picked and triggered anyway, as if it was visible. Is it the correct behaviour ? Should I use a more traditionnal picking code instead ?
  14. Hello, is it possible to use mesh.actionManager.registerAction(new BABYLON.SetValueAction({ trigger: BABYLON.ActionManager.OnIntersectionEnterTrigger, parameter: otherMesh }, mesh, "scaling", new BABYLON.Vector3(1.2, 1.2, 1.2))); http:// without defining the 'otherMesh' at the beginning.So that i get the 'otherMesh' as an object when the trigger fires/ on Intersection? Thanks!
  15. Hello to community ! It's time to present you the Actions Builder that is a part of the 3ds Max plugin (and soon available in the Sandbox). The Actions Builder is an initiative of the Babylon.js team to help 3ds Max artists to create actions on their meshes without any line of code. Installing the Actions Builder The Actions Builder is a folder named "BabylonActionsBuilder" located in the same folder as the Babylon.js 3ds Max plugin (typically "C:\Program files\Autodesk\3ds Max 2015\bin\assemblies\"). The "BabylonActionsBuilder" folder must contain: - "fonts" folder - actionsbuilder.max.js - babylon.max.js - fonts.css - index.css - index.html - raphael.js Using the Actions Builder The way to work with is simple: - Select a mesh in 3ds Max - Right click on it - Select the "Babylon..." menu and click on the "Babylon Actions Builder" menu - The Actions Builder window appears - You can now add actions to your meshes - Export your project using the Babylon.js plugin and that's all Configuring actions in the Actions Builder Each action you'll add on your meshes is raised by a trigger. On the left side you have a list of elements ready to be drag'n'dropped in the graph (middle side): - Triggers: events that raise actions - Actions: actions executed by Babylon.js - Conditions: conditions checked before executing an action The pipeline is: - Drag'n'drop, from the list, triggers on your mesh - Drag'n'drop, from the list, an action/condition of your choice on one of you triggers or actions - At any time, click on an action, trigger or condition to edit its parameters. Parameters appear in the right side of the window Conclusion Full presentation and tutorial are available here: It's a call for help, 3ds Max users, to get your feedbacks on this feature to improve and improve it again. By hoping you'll get a rich experience with actions
  16. Hi, I'm looking at the excellent example at (lines 118-130) and was wanting to know if there was a way to attach an action to a Dynamic Texture (line 118), or it's related 'context' (line 126) ? I was wanting to use this idea in an in-game 'menu', and be able to display a set of options, you know, like a menu... and the user to be able to select one. I'm using a ArcRotateCamera and love how the text is always facing the user. I believe that an ActionManager is only attachable to a Mesh (and not a DynamicTexture), and the canvas CanvasRenderingContext2D object that the myDynamicTexture.getContext() returns doesn't appear to have any funtionality I'm after (like readMousePosition() or something similar). I initially thought of producing 2D Plane meshes for the menu, but I'm not entirely sure how to go about forcing them to be always facing the user ? Any ideas or guidance is very appreciated. Thanks, bws.
  17. I have a multiview, 3 cameras and viewports, and switching from "old way" to manage actions to the actionmanager one. I use ExecuteCodeAction with trigger OnLeftPickTrigger and it does activate an event only on one of the views, so one camera only. RegisterAction has no camera parameter thus I would expect babylon manages the right camera for picking meshes, based on viewports and mouse coordinates, but it does not seem the case. Any clue or suggestion? Thanks
  18. The general question is: what if I need to remove an action from an actionManager ? I looked for a unregisterAction/deregisterAction on ActionManager class, or a dispose method on the action class but it's not available, am I missing something or it's a feature to implement ? My usecase: I use thin cylinder meshes to draw wires, in order to use mesh collision actions. Wires can be set longer or shorter at runtime, so I dispose and recreate those meshes, but what happens to the actions registered on the actionManagers of the other meshes (OnIntersectionEnterTrigger,OnIntersectionExitTrigger) to check for object-wire collisions ? I'm afraid they remain even if they can no more be called, being the mesh disposed now. Thanks
  19. The below code is a snippet from the following location: My question should clarify what I'm asking, even though the above code works (eg. doesn't throw an error). What I was trying to accomplish was taking both actions and causing them to fire at the same time. So far the above code sets both properties, but only by allowing it to take turns alternating each time the intersection occurs. My question is: is there a way to change both "scaling" and "emissiveColor" during the same intersection instance? Thanks in advance for the help.
  20. Hi folks, I've been studying and learning Babylon js for a couple of months now, great stuff so far! However I've run into an issue, which seems to be either with OnPointerOverTrigger or ExecuteCodeAction. Basically I want to call a function when you either mouse over/out a mesh, however the function only receives the meshUnderPointer on the OnPointerOutTrigger, not OnPointerOverTrigger. Is this a bug or am i misunderstanding how this is meant to work? I've put an example on the playground, the console log shows no meshUnderPointer for the OnPointerOverTrigger event. Thanks
  21. Hi everyone, I'm a newbie in development. i'm using babylon v1.11.0 and i want to use the actionManager object but it seems undefined in the javascript source file and i didn't find it in the documentation despite of the tutorial about it . I don't know why i can't use it. Thanks in advance for your help.