Art Vandelay

Interesting drag and drop issue

Recommended Posts

Hi,

I took the drag and drop demo and added collisions to it. Basically that means that in onPointerMove:

  1. I move the mesh
  2. I do mesh.computeWorldMatrix
  3. I check for an intersection of the mesh with every other mesh and if I discover one I move the mesh back

Everything works fine and the meshes generally don't "go through" each other. However, if I drag a mesh fast enough it will slightly intersect with another mesh before actually being stopped by it. I can't understand why this is happening.

Any ideas?

Thanks! :)

Share this post


Link to post
Share on other sites

Hi.  I'll help with the PG.  https://www.babylonjs-playground.com/#O3KE1#6

Notice lines 102-104.  During drag, if green box intersects blue box, quit onPointerMoving.

Now... drag blue box... at high velocity... into side of green box.  They overlap.  And they are stuck in intersect-state, so, no more onPointerMove happens ever again (without the help of a crowbar)  :)

Hope this helps.  Hey, what if we invented mesh.deIntersect()... called from the collide observer.  It does a careful analysis of bounding boxes, and determines WHICH DIRECTION to start moving the .source... to make it eventually de-intersect (and clear the intersect state).  There could also be a "speed" setting.  Wow!  Essentially, animateFromIntersect(). 

But yeah, high-horsepower dragging is not for children.  Penetration can happen.  :o

Share this post


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

  • Recently Browsing   0 members

    No registered users viewing this page.