saeed Posted January 2, 2017 Share Posted January 2, 2017 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 http://www.html5gamedevs.com/topic/16994-understanding-drag-and-drop-playground-sample/ and implement http://playground.babylonjs.com/#279FW9#4 , its good but i want to use actions and triggers (ActionManager) for pick up/down/move and collision detection. Thanks . Quote Link to comment Share on other sites More sharing options...
Wingnut Posted January 3, 2017 Share Posted January 3, 2017 Hi Saeed, welcome to the BabylonJS forum. I began modding a playground... http://playground.babylonjs.com/#279FW9#28 There's good actionManager picks/clicks on all three spheres (see console), but... according to the ActionManager docs, there is no onPointerMove trigger. Soooo... hmm. I'm not sure if pure ActionManager dragging... can be done, yet. Perhaps SOMETHING could be done with scene.onPointerObservable, but that's not ActionManager-based. Maybe we can add an onPointerMove trigger to the actionManager class. That's a big maybe. Interesting challenge, though. I'll keep thinking and testing. Others may comment soon. saeed and paleRider 2 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted January 5, 2017 Share Posted January 5, 2017 Okay, Saeed, you owe me a beer. http://playground.babylonjs.com/#279FW9#32 Watch console, drag-intersection reports happening there. I'm using a pointer observer (line 129) for the needed pointer move listener (not actionManager, but not DOM events, either). All other DOM events are gone. This is now an ActionManager-intensive playground. Just what you asked-for. From your friends... at BJS Forums/Knowledge-base. I wish "parameter" in those intersect triggers... were allowed to be "any" or "null" (trigger on enter/exit intersect with ANY other mesh). That would save us 24 action registrations. Maybe I will code-up a mod. (Or beg a mod from a "big dog" core guy) Dragged mesh sticks to pointer, sometimes (when doing pickUP when drag pointer-tracking is far-inaccurate). Speak of which, pointer arrow doesn't PERFECTLY-track dragged mesh. I'll let you and/or others work-on those things. saeed, paleRider and iiceman 3 Quote Link to comment Share on other sites More sharing options...
iiceman Posted January 5, 2017 Share Posted January 5, 2017 That looks fun, nice playground Wingy! You could shorten the annoying trigger building a bit with some good old for-loops: http://playground.babylonjs.com/#279FW9#33 saeed, paleRider and Wingnut 3 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted January 5, 2017 Share Posted January 5, 2017 Oh yeah, I forgot about those FOR-loop things. heh. Thanks Iceman! Good to see you again, too. Quote Link to comment Share on other sites More sharing options...
saeed Posted January 7, 2017 Author Share Posted January 7, 2017 On 1/3/2017 at 7:32 AM, Wingnut said: Hi Saeed, welcome to the BabylonJS forum. I began modding a playground... http://playground.babylonjs.com/#279FW9#28 There's good actionManager picks/clicks on all three spheres (see console), but... according to the ActionManager docs, there is no onPointerMove trigger. Soooo... hmm. I'm not sure if pure ActionManager dragging... can be done, yet. Perhaps SOMETHING could be done with scene.onPointerObservable, but that's not ActionManager-based. Maybe we can add an onPointerMove trigger to the actionManager class. That's a big maybe. Interesting challenge, though. I'll keep thinking and testing. Others may comment soon. Many thanks . yes i'm using this approach now . Quote Link to comment Share on other sites More sharing options...
saeed Posted January 7, 2017 Author Share Posted January 7, 2017 On 1/4/2017 at 6:26 PM, Wingnut said: Okay, Saeed, you owe me a beer. http://playground.babylonjs.com/#279FW9#32 Watch console, drag-intersection reports happening there. I'm using a pointer observer (line 129) for the needed pointer move listener (not actionManager, but not DOM events, either). All other DOM events are gone. This is now an ActionManager-intensive playground. Just what you asked-for. From your friends... at BJS Forums/Knowledge-base. I wish "parameter" in those intersect triggers... were allowed to be "any" or "null" (trigger on enter/exit intersect with ANY other mesh). That would save us 24 action registrations. Maybe I will code-up a mod. (Or beg a mod from a "big dog" core guy) Dragged mesh sticks to pointer, sometimes (when doing pickUP when drag pointer-tracking is far-inaccurate). Speak of which, pointer arrow doesn't PERFECTLY-track dragged mesh. I'll let you and/or others work-on those things. Thanks for the best help in there . just a perfect solution . Wingnut 1 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.