Art Vandelay Posted November 14, 2017 Share Posted November 14, 2017 Hi, I realize this is a topic that was covered before but I couldn't find a solution and wasn't sure if there was one now. I have several imported meshes in a scene (relatively complex ones) and I can drag and drop one at a time. I want to check whether the mesh I am dragging has collided with a different one. In that case it is blocked and can't be dragged further. The problem is I would like to check this precisely, meaning exactly when two meshes touch each other, and not just by using a bounding box. Is there any way to do this? Thanks for your help! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 14, 2017 Share Posted November 14, 2017 Hello, the only way would be via physics engine The MeshImpostor is certainly the way to go (http://doc.babylonjs.com/how_to/using_the_physics_engine) Art Vandelay 1 Quote Link to comment Share on other sites More sharing options...
Art Vandelay Posted November 14, 2017 Author Share Posted November 14, 2017 Thanks @Deltakosh! Will try it out. Quote Link to comment Share on other sites More sharing options...
Art Vandelay Posted November 15, 2017 Author Share Posted November 15, 2017 Quick question. I noticed in the table in the documentation it says that for impostor type "mesh" oimo.js uses a box. Does this mean what I want to do is impossible with oimo.js? Thanks Quote Link to comment Share on other sites More sharing options...
RaananW Posted November 15, 2017 Share Posted November 15, 2017 yes, that's what it means Only cannon has a mesh impostor, and it only collide against spheres, so I am not sure it will work anyhow. I think the only way to really do that is to check for intersections constantly, but I am not sure how CPU-intensive that is. Quote Link to comment Share on other sites More sharing options...
Art Vandelay Posted November 15, 2017 Author Share Posted November 15, 2017 Checking for intersections doesn't use impostors as well? Quote Link to comment Share on other sites More sharing options...
Wingnut Posted November 15, 2017 Share Posted November 15, 2017 Hi guys. Sorry for interrupting in the middle of a pending clarification question. I just wanted to remind of the "surround with simple impostors" trick. On mesh that aren't too complex, you can add (invisible) boxes along the edges of the mesh, and put a box impostor on each one. In the below playground, I didn't add any physics to my "ridge boxes" yet, or ever. But, in theory, it COULD work. The ridge/edge boxes would need to be parented to something, so they wouldn't fly away-from mesh... upon impact. But, in theory, 2-20 of these edge-physics "shapes"... could do physics reactions off-of one-another... fairly well. No meshImpostors, no spheres-only limitations, but some meticulous ridge-box placements. https://www.babylonjs-playground.com/#1UHFAP#195 Here, you can see the ridge/edge boxes in white... un-parented-ly positioned upon/around the plotted mesh. Two of the ridge-positionings... are broken. Dunno why. Anyway, perhaps this is a good starter playground for doing some physics tests on "ridge-physics" shapes. Turn-on the physics, impostor the ridge-boxes, parent them to something (inside makeThing() func). Then generate 5-10 "things", put them in a box or tumble them across a ground... see how well they work... if wanted. Tell/show results, if you please. Note: Avoid impostor overlap at places where multiple ridge-boxes come together, if possible (I think). Ok, now, back to the question at-hand, for-which I am curious about the answer. Party on! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 15, 2017 Share Posted November 15, 2017 For intersections: Nope it uses mesh bounding info and geometry directly Quote Link to comment Share on other sites More sharing options...
Wingnut Posted November 15, 2017 Share Posted November 15, 2017 Aww, what the heck... I'll ask something, too. Doesn't Art lose "precise collisions" by using boundingInfo? http://playground.babylonjs.com/#HE5NZP Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 15, 2017 Share Posted November 15, 2017 precise means "use the mesh" so I would say yes Quote Link to comment Share on other sites More sharing options...
Wingnut Posted November 15, 2017 Share Posted November 15, 2017 I'm confused. I'm not an intersect pro... sorry. Ok, single mesh drinking glass. No extra collision-sensor mesh. Drop marble into glass. Can we detect collision with bottom of glass? Or will collision trigger when marble passes glass-lip? *scratch scratch* I should test. "precise" parameter... and we get bottom-of-glass collision? If so, cooooool. Quote Link to comment Share on other sites More sharing options...
Art Vandelay Posted November 15, 2017 Author Share Posted November 15, 2017 Sorry, I'm still a little confused too (but greatly appreciate the answers). @Deltakosh When you say mesh bounding info and geometry directly, I understand there is no impostor used, but is the bounding info accurate? Meaning not just a box or a sphere etc... Thanks again Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 15, 2017 Share Posted November 15, 2017 BoundingInfo is the combination of a bounding box and a bounding sphere 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.