Jump to content

usage of OnIntersectionEnterTrigger with Rectangle2D objects


ller
 Share

Recommended Posts

Hi everyone,

I am pretty new with babylon.js and have a question about the ActionManager.OnIntersectionEnterTrigger.

Is it possible to use this trigger with Rectangle2D in a ScreenSpaceCanvas2D?

So what I want to do is to move 2D objects in a ScreenSpaceCanvas2D and trigger a event if two of them overlap on each other.

I have already tried several thing but it doesn't seems to work..

Thanks for any feedback :)

 

 

Link to comment
Share on other sites

OK, thanks.

I already use the pointerEventObservable to pick up a element with the mouse and move it.

My problem is to detect if two 2D objects intersect with each other.

If I understand you correct I have to manage this by myself by using the current pointer position and check if the bounding box of the moving object intersects with a bounding box of another element?

is there such a thing as best practice?

Link to comment
Share on other sites

@ller nope, there's no such thing (yet). You're the first to ask for that and I'm amazed about all the things that should be considered as "must have" and that I didn't think about in the first place, because it's obvious that there should be some intersection code between two primitive, but right now, if I remember correctly you don't even have intersection of two boundingInfo2D objects...

As I told, I didn't planned for this but it's a must have, I'll work on it as soon as possible, in the meantime try to work on something else, I hope I'll solve it in few days.

Link to comment
Share on other sites

@ller I'm progressing, WorldAABB computation/update is done, partitioning is done, intersection of AABB is done. Now I need to make the different intersection algorithm between primitive types, because any kind of prim can intersect any other kind, well, there's in theory a lot of different cases right there already. I think I may rely on a mix of:

  1. TypeA versus TypeB
  2. TypeA's auto generated triangleList versus TypeB's auto generated triangleList (to reduce the overall cases count).

 

primIntersection01.png

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