Kesshi Posted February 26, 2016 Share Posted February 26, 2016 In this playground: http://www.babylonjs-playground.com/#1XJSAN there is a red and a white box. The red box has a click action attached to it. The problem is that the action is triggered even if i click on the white box. In line 33 i enabled "constantlyUpdateMeshUnderPointer" because i was thinking this is the solution but it doesn't help. Is there something else i need to do? The strange thing is that the mouse cursor is not changing when the mouse is over the white box ... so for the cursor the handling is correct. One more question. Is it possible to define which cursor is shown for a mesh? Lets say the move or resize cursor. Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted February 26, 2016 Share Posted February 26, 2016 just watch this http://www.babylonjs-playground.com/#1XJSAN#1 may be you can find your solution Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Kesshi Posted February 26, 2016 Author Share Posted February 26, 2016 14 minutes ago, NasimiAsl said: just watch this http://www.babylonjs-playground.com/#1XJSAN#1 may be you can find your solution I wouldn't call this a solution. Its a workaround. I would need to attach an Action to every mesh in my scene .. and i have a lot. So this is not an option. NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted February 26, 2016 Share Posted February 26, 2016 Hey guys. http://www.babylonjs-playground.com/#1XJSAN#2 A little testing playground. I hijacked-in some of the pertinent funcs from BABYLON.Scene... makes them easily hack-able. Might be a nice place to cause some trouble. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 26, 2016 Share Posted February 26, 2016 This is a really good question. I added a way for you to define the predicate used to select meshes when picking: http://www.babylonjs-playground.com/#1XJSAN#4 Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted February 26, 2016 Share Posted February 26, 2016 i think it is pick bug ( am i right? ) action trigger need fired when in first mesh (in list of picked) . Quote Link to comment Share on other sites More sharing options...
Wingnut Posted February 26, 2016 Share Posted February 26, 2016 @Deltakosh This is a nice addition, but... On 2/26/2016 at 9:15 AM, Kesshi said: I wouldn't call this a solution. Its a workaround. I would need to attach an Action to every mesh in my scene .. and i have a lot. So this is not an option. ...he doesn't want to use any actionManagers, if I understand him correctly. Or maybe ONLY a single scene.actionManager. He needs something more like http://playground.babylonjs.com/?11 Maybe. (is ?11 working at all? hmm.) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 26, 2016 Share Posted February 26, 2016 48 minutes ago, NasimiAsl said: i think it is pick bug ( am i right? ) action trigger need fired when in first mesh (in list of picked) . Nope...the picking system only considers meshes with actionmanagers. This is why I allowed developers to change the predicate function Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 26, 2016 Share Posted February 26, 2016 @Wingnut: this is the case in my example. Only one actionmanager. Quote Link to comment Share on other sites More sharing options...
Kesshi Posted February 26, 2016 Author Share Posted February 26, 2016 2 hours ago, Deltakosh said: This is a really good question. I added a way for you to define the predicate used to select meshes when picking: http://www.babylonjs-playground.com/#1XJSAN#4 Thank you. I think this should help me. What about my second question: Is it possible to define which cursor is shown for a mesh? Lets say the move or resize cursor. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 26, 2016 Share Posted February 26, 2016 So far it is hard coded Quote Link to comment Share on other sites More sharing options...
Wingnut Posted February 26, 2016 Share Posted February 26, 2016 But if he has 4000 pickable mesh, he needs an AM on each one, right? Hi again, K. Are you cool with having an AM on each pickable mesh? Sounds like you are. I must have misunderstood. Or maybe you have no other choice. You would have preferred to avoid that, right? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 26, 2016 Share Posted February 26, 2016 @WingnutNo. This is not what my sample shows Quote Link to comment Share on other sites More sharing options...
Kesshi Posted February 26, 2016 Author Share Posted February 26, 2016 @Wingnut you misunderstood the solution from Deltakosh. There is only one ActionManager like i wanted. The only thing that i need to do is to overwrite the picking predicate so it fits my needs. This is a very flexible solution. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted February 26, 2016 Share Posted February 26, 2016 ahh, ok, thanks guys... sorry if I was a hassle. Quote Link to comment Share on other sites More sharing options...
satguru Posted February 26, 2016 Share Posted February 26, 2016 So this a bug fix and an additional feature ? Due to the additional feature I can now override the action manager by making the mesh.isPickable to false. Right? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 26, 2016 Share Posted February 26, 2016 Not a bug fix as the code worked as intended. But you came with a new use case so I developed a new feature Your assumption is correct btw Quote Link to comment Share on other sites More sharing options...
Wingnut Posted February 26, 2016 Share Posted February 26, 2016 Satguru, I think mesh.isPickable = false... always "turns off" the mesh's actionManager picker, even before the new features. No changes to that. http://www.babylonjs-playground.com/#1XJSAN#5 "sat guru"? Satellites? Quote Link to comment Share on other sites More sharing options...
satguru Posted February 26, 2016 Share Posted February 26, 2016 @Wingnut sat = true guru = teacher satguru = the one and only true teacher - I am the man !! Ok, something weird here http://www.babylonjs-playground.com/#1XJSAN#6 i changed your "tActionBox.isPickable = false;" to "tActionBox.isPickable = true;" and now both tCube and tActionBox send out alert on being clicked/ Quote Link to comment Share on other sites More sharing options...
Kesshi Posted February 26, 2016 Author Share Posted February 26, 2016 @satguru please have a look at the version from deltacosh again: http://www.babylonjs-playground.com/#1XJSAN#4 the important part is at line 33 - 39. With this new predicates you can create your own rules to define which mesh should be picked and which not. The problem in my initial version was that the white box wasn't picked (it was ignored because it had no action), therefore only the red box was picked. If you change the predicate to "return mesh.isPickable;" it means all meshes which have "isPickable == true" will be considered in the picking. No other condotion need to be fulfilled. (like if there is an action or not) You could also just change it to "return true" to pick every mesh without any condition. adam and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
adam Posted February 26, 2016 Share Posted February 26, 2016 Adding another box and assigning the action manager to it helped me to understand how it works. http://www.babylonjs-playground.com/#1XJSAN#8 Quote Link to comment Share on other sites More sharing options...
adam Posted February 26, 2016 Share Posted February 26, 2016 In this PG only boxes that have a y position less than 0 (and an actionManager) are picked: http://www.babylonjs-playground.com/#1XJSAN#12 Quote Link to comment Share on other sites More sharing options...
satguru Posted February 27, 2016 Share Posted February 27, 2016 I think the way the triggers are named, creates some confusion Instead of onPickUpTrigger, onPickDownTrigger maybe they should be called onPointerUpTtrigger, onPointerDownTrigger Picking and Pointer events are two different things Picking helps in determining if the pointer can be considered as being on top of a mesh and thus 1. if the cursor should change to a hand cursor and 2. if pointer events should lead to some actions @Kesshi, In your first example, and like you pointed out, there is inconsistency in the behavior of the cursor and the action. The cursor does not change to hand when it is on the white box- which means the system thinks that the cursor is on top of white box and not the red box (or put another way - white box is pickable and the picking system picks that as it is in front of the red box) The action behaves differently The action takes place when the cursor is on the white box and the pointer is clicked - which means, for action, the system thinks that the cursor is on the red box (or put another way - white box is not pickable and the picking system ignores the white box even though it is in front of the red box and picks the red box instead) I like the idea of predicate but I wonder if it should be at the action level rather than at the scene level. Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted February 27, 2016 Share Posted February 27, 2016 ok i have questions about action manager 1. why we need have actionManager system when we have picking system. 2. dos it have any benefits ?(picking is not have that?) 3. if it good and useful for all system why we need picking too. 4. and last question is that why actionManager not use picking system. for example if we have just picking system in base and have actionManager use that picking system we solved problem(first problem in this post) box1.registerActionManager(...); box2.isPickable = true; so box1 don't answer when box1 is fired pick but is not happen now http://www.babylonjs-playground.com/#1XJSAN#13 Quote Link to comment Share on other sites More sharing options...
satguru Posted February 27, 2016 Share Posted February 27, 2016 @NasimiAsl actionManager does more than picking for example OnIntersectionEnterTrigger , OnIntersectionExitTrigger , OnKeyDownTrigger , OnKeyUpTrigger "isPickable" is ignored if you use your own predicate for example here var myPickableTest = function (mesh) { return mesh == ground; }; var pickinfo = scene.pick(scene.pointerX, scene.pointerY,myPickableTest ); Here we ignore "isPickable" and only pick if the mesh is ground. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.