Reduce Collision questions.

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Arathmir
Posts: 2
Joined: Mon Oct 16, 2017 9:15 am

Reduce Collision questions.

Post by Arathmir » Mon Oct 16, 2017 9:34 am

I created 2 entitys with more then one bounding objects. (boxes , spheres, cylinders). Now i tried to achiev a detection between both objects. The detection is working well, but in my case this models have a lot vertices. I tried to show up all collisions with lines. To see why my performance is going down. And it seems like there are more then thousands physical detections.

So my questions is how to reduce the amount of detections, after the first vertice collided? Is there a possibility to reduce it or to stop bepu doing that amount of collision? Am i doing something wrong? :-P

Norbo
Site Admin
Posts: 4558
Joined: Tue Jul 04, 2006 4:45 am

Re: Reduce Collision questions.

Post by Norbo » Mon Oct 16, 2017 6:58 pm

Collision detection is built to find contacts for the purposes of collision response, so it doesn't support a 'stop after first collision' boolean style test by default.

However, I'm not entirely clear on the setup- thousands of contacts would suggest that the involved objects are very complicated and intersecting meshes, not boxes and spheres. If the collision shapes are in fact meshes, the biggest improvement would be to change it to using simple primitive approximations.

If they're not meshes, I'm not sure how you are getting to thousands of contacts unless each entity is a compound containing thousands of shapes; a reproduction in the demos application would be helpful for me to understand the situation in this case.

Arathmir
Posts: 2
Joined: Mon Oct 16, 2017 9:15 am

Re: Reduce Collision questions.

Post by Arathmir » Tue Oct 17, 2017 7:19 am

Hallo Norbo, thx for the fast answer.

In my first step i tried to make 2 mobile meshes for exact collision tests. But after all i tried to use simple geometries which bepu is supporting. like boxes, Spheres, cylinders. Now i have a tree of meshes. with 3 cylinders and maybe 4 or 5 boxes.
this step is far more performant like the other but now i am interested in solving the new problem.
After the first collision response the rest should be ignored. cuz i only want a detection. in my point of view is no need to find the other contacts if i got the first contact.

Norbo
Site Admin
Posts: 4558
Joined: Tue Jul 04, 2006 4:45 am

Re: Reduce Collision questions.

Post by Norbo » Tue Oct 17, 2017 6:49 pm

Specialized boolean queries aren't supported out of the box at the level of the narrow phase. You could do something like the CharacterController's QueryManager.QueryContacts for individual objects, stopping when you identify a pair with nonzero contacts, but it could just end up being slower than the regular narrowphase.

Also, within individual primitive pairs like sphere-box or box-box, there is no general 'stop at the first contact' feature in pair handlers- a box-box pair is going to generate the full required manifold regardless. There do exist some scattered boolean tests like BoxBoxCollider.AreBoxesColliding, but these are not generalized across all pair types.

Given the amount of grossness involved in trying to bypass the narrowphase and the fact that it might actually be slower for a variety of reasons, I'd be very careful about jumping down that rabbit hole unless you really, really need to.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests