Jump to content

need a sample for dragging and collision detection implemented by actionmanager


saeed
 Share

Recommended Posts

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 .

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 .

Link to comment
Share on other sites

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 .

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...