Search the Community
Showing results for tags 'Actions'.
-
I use onIntersectionEnterTrigger and onIntersectionExitTrigger to detect intersections in my project. As far as I understand for each mesh BabylonJS draws precise bounding box and both triggers use it. Everything went well untill I ran into round objects. So my first question is is it possible to change bounding box to bounding sphere and how to do it? and the second is does BabylonJS also draw bounding sphere for each mesh or I need to draw it by hand?
-
Hi, have encountered such issue, I am listening on pointer events observable: scene.onPointerObservable.add(this.onPointer); this method listens to down, up, move events: function onPointer(info: PointerInfo) { if (info.type === PointerEventTypes.POINTERMOVE) { this.handleMove(info.event); } else if (info.type === PointerEventTypes.POINTERUP) { this.handleUp(info.event); } else if (info.type === PointerEventTypes.POINTERDOWN) { this.handleDown(info.event); } } all woks well till on some android devices PointerUp is not triggered, after some investigation found out that event was canceled so PointerCancel was triggered instead of PointerUp, but after digging in the code saw that engine doesn't handle them at all. Anyone had issues with pointer events being canceled ? maybe some solutions ? As it's not trivial to add cancel event handling as on some devices both Cancel and Up is handled at the same time. Thank you for any info.
-
I'm a bit lost and confused about PlayAnimationAction. Here's a PG. Click on the cube to play animations. There doesn't seem to be a way to target only one of the defined animations - it always plays both. I would have expected there'd be a way to specify which animations (by name) should be played when this action is triggered. Am I missing a trick here?
-
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
-
Hello, I've got info that both setting all meshes as active and calling freezeActiveMeshes() should improve the performance, because it turns off some expensive calculations. So I tried to implement this feature. But in my case: 1. If I only call mesh.alwaysSelectAsActiveMesh = true for all meshes - DebugLayer shows smaller potential FPS, by ~100. Should it be like that? I have <100 meshes, nothing very complex. Maybe disabling detecting visible meshes enables some other expensive calculations?! Then I thought that freezing should help with that. But that gave me 2 more problems 2. If I use AssetsManager -> addMeshTask -> loader.onFinish() -> scene.freezeActiveMeshes() I get an error: TypeError: Cannot read property '0' of undefined at t.isInFrustum (babylon.js:8) at t.isInFrustum (babylon.js:8) at r.i.isInFrustum (babylon.js:9) at r.isInFrustum (babylon.js:15) at i._evaluateActiveMeshes (babylon.js:13) at i.freezeActiveMeshes (babylon.js:13) at i.Game.loader.onFinish (index.js:64) at i._decreaseWaitingTasksCount (babylon.js:48) at i (babylon.js:48) at i.e.onDoneCallback (babylon.js:48) What does it mean? In my example - http://www.babylonjs-playground.com/#MPS90E#6 - try to uncomment Line 28 to get the same error. I was hoping to freeze active meshes right after they all were loaded. 3. If I put scene.freezeActiveMeshes() somewhere later - all my actions are disabled/removed, nothing happens when one mesh intersects some other, creation of decals also disappears, particleSystem also doesn't work. Some kind of "freeze the world". Example with intersections only - http://www.babylonjs-playground.com/#MPS90E#6 You see a moving red mesh - when it exits from yellow mesh - "intersection" should appear in the console. But after the first time scene.freezeActiveMeshes() is called and nothing is printed out any more. If you comment out the line 93 - every iteration prints "intersection". Can you please explain what am I doing wrong in these 3 questions and how to fix them? Thanks!
-
Hey guys... while refactoring some code, I ran off down the path of changing my old picking method (Raycasting, etc) to use actions... specifically OnPickTrigger with ExecuteCodeAction. But... I was a bit confused when I could not find the picked point on the mesh in the event data. Am I missing something?
-
Hi everybody: I have a doubt on registered Actions, is possible to retrieve the pickedPoint from the callback parameter? I mean something like we have with Observables via the "d" param (d.pickInfo.pickePoint), in order to avoid to implement always the pick-result-check as shown in the following code (excerpt): myMesh.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickDownTrigger,function(evt){ var pickResult=scene.pick(scene.pointerX,scene.pointerY); if(pickResult.hit){ ... } })); Best regards.
-
Hi, I am developping a virtual environment using webVRcamera to render it with HTC Vive Headset. I have no problems to see the scene into HTC Vive, however, I cannot move, the controllers do not work. I have tested this playground and there I can't move too. How could I solve it? http://playground.babylonjs.com/#ASDZLT#20 Thanks!
- 4 replies
-
- virtual reality
- camera
-
(and 1 more)
Tagged with:
-
Hi, I'm trying to show a text label when I hover the mouse over a mesh (sphere). It needs to show up at the exact position of the sphere. Something like: OnPointerOverTrigger -> show text label OnPointerOutTrigger -> hide text label Not sure if I have to use actions... trigger... pick()...text2d. Couldn't figure it out. Is there a way to do it using HTML? Playground: http://www.babylonjs-playground.com/#NH8WYW Can anyone help me? Thanks
-
PLAYGROUND : http://playground.babylonjs.com/#1GM4YQ#123 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
- 6 replies
-
- onpicktrigger
- actions
-
(and 3 more)
Tagged with:
-
Hi, could anyone provide me with a standard example for an ExecuteCodeAction. I haven't been able to find any examples. I can verify that the code below doesn't work Part of my problem is that I don't understand what the conditional at the end is for... Thanks! ''' var makeClickResponse = function(mesh){ mesh.actionManager = new BABYLON.ActionManager(scene); mesh.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnLeftPickTrigger, function(){console.log("it works! "+mesh.name)}, true)); } '''
-
I'll start off by saying I'm very new to Babylonjs so excuse my incompetence if I'm doing something silly. So I'm creating a town building sim and I'm handling the building creation by creating a grid of invisible cubes that can turn into specific buildings when clicked on in "Build Mode". I have a button that handles going in and out of "Build Mode" and it alternates a buildMode variable from true to false. What I'm trying to do is register the action that handles the highlighting of the build areas, the cubes, when buildMode equals "true" and unregister it when it equals "false". Here's how I'm handling it so far: scene.registerBeforeRender(function() { for(var i = 0; i < 144; i++){ var currentBox = scene.getMeshByName("box" + i); var overAction = new BABYLON.SetValueAction(BABYLON.ActionManager.OnPointerOverTrigger, currentBox, "visibility", 1); var outAction = new BABYLON.SetValueAction(BABYLON.ActionManager.OnPointerOutTrigger, currentBox, "visibility", 0); if(buildMode == true) { currentBox.actionManager.registerAction(overAction); currentBox.actionManager.registerAction(outAction); } else { currentBox.actionManager.actions.pop(overAction); currentBox.actionManager.actions.pop(outAction); } } }); It works going from buildMode false to true but not true to false, as in I click the button and build mode enables but it the actions are still working when I click the button again. Also, am I right in saying that I could maybe avoid all this if I just add a condition to the Action and add the action to the boxes when I first create them? I tried looking into that but I'm not really sure how BABYLON.ValueCondition works. As I said I'm pretty new at this so any help would be great.
- 10 replies
-
Well here is my Christmas card for the BJS forum. Basically some memories of Christmas past - all rolled into one. A story of some of my Past Christmas eves. Twas The Night Before Christmas As far as BJS is concerned, a lot of use of instances - bows, bells and streamers - but also furniture. The clock tells the time on your computer, and music will be played. It features a lot of click and stuff happens - something iiceman suggested earlier in the month. Ooh - there is a key hidden in the room - can you find it? I had thought that the clock would start out stopped and you could use the key to rewind it - but time ran out Anyway, Merry Christmas to all - hope you enjoy it. cheers, gryff Note: the approach is a Victorian space, and the cat on the wall (and the landscape) may not look quite Victorian - but they are actual quilts a craft that goes back several hundred years. They were done with a quilting technique known as "needle painting". They are unique, and both came to me as Christmas presents.
-
Hello, I am quite new to Babylon JS. I was wondering if there is a way to morph the selected vertices on click. I read the documentation, and tried all their examples, but have yet to come up with a solution. So far I have this code below. scene.onPointerDown = function(evt, pickResult) { if (pickResult.hit) { // code for mophing selected vertices here. var chosenMesh = pickResult.pickedMesh; } } I am stuck right at this point. I did some console logs and chosen mesh seems to select the entire plane. I also tried pickResult.faceId and it gives me the Id of the selected face, however, I am not sure how I can edit this particular face on the height map. Any ideas? Or examples? Thanks for your help.
-
Hey guys, I was working on a little project and would like to have some click actions on a sprite. But somehow it doesn't work. Is it not meant to work? And if not, why? Using actions would be cool because I am not sure yet if I only need clicking or maybe some other stuff, too, and actions make it pretty easy. Just wanna make sure it's not me being stupid and just using it wrong Example: can click sphere, can't click player sprite: http://www.babylonjs-playground.com/#9RUHH
-
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: https://medium.com/babylon-js/actions-builder-b05e72aa541a 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
-
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
-
I am playing around and got this: http://www.babylonjs-playground.com/#1QBHYZ#2 http://www.babylonjs-playground.com/#1QBHYZ#3 http://www.babylonjs-playground.com/#1QBHYZ#5 Edit: probably final version: http://www.babylonjs-playground.com/#1QBHYZ#6 If anybody finds a bug or something that doesn't seem right, please let me know Any ideas for improvements? Every input is very appreciated!