saeed

need a sample for dragging and collision detection implemented by actionmanager

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 .

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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 .

Share this post


Link to post
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 .

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.