ller Posted January 10, 2017 Share Posted January 10, 2017 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 10, 2017 Share Posted January 10, 2017 Ping @Nockawa Quote Link to comment Share on other sites More sharing options...
Nockawa Posted January 10, 2017 Share Posted January 10, 2017 The ActionManager is not as complete as the event system specific to Canvas2D, so you better rely on the pointerEventObservable, more in here: http://doc.babylonjs.com/overviews/Canvas2D_Interaction Quote Link to comment Share on other sites More sharing options...
ller Posted January 11, 2017 Author Share Posted January 11, 2017 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? Quote Link to comment Share on other sites More sharing options...
Nockawa Posted January 11, 2017 Share Posted January 11, 2017 @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. Quote Link to comment Share on other sites More sharing options...
Nockawa Posted January 18, 2017 Share Posted January 18, 2017 @ller I'm starting to work on the feature now. I don't know how long it will take because I may be tempted to implement a very efficient partitioning algo (or at least not a dumb O(n²) ). I'm in brainstorming phase right now... Quote Link to comment Share on other sites More sharing options...
Nockawa Posted January 23, 2017 Share Posted January 23, 2017 @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: TypeA versus TypeB TypeA's auto generated triangleList versus TypeB's auto generated triangleList (to reduce the overall cases count). jerome and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
Nockawa Posted January 28, 2017 Share Posted January 28, 2017 @ller hello, I've completed the feature, code-wise. as soon as the PG is update I'll make an example and also a doc. 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.