ncollide icon indicating copy to clipboard operation
ncollide copied to clipboard

Is there a direct way to check for interferences with a convex polygon?

Open janhohenheim opened this issue 6 years ago • 1 comments

CollisionWorld currently exposes methods for the retrieval of interferences with a ray, a point or an AABB. For my use-case however, I need to retrieve all objects that interfere with a ConvexPolygon.

My current approach is the following.

  1. Enclose the polygon in an AABB
  2. Retrieve the interferences with said AABB
  3. Filter them manually by using the Separating Axis Theorem in order to check if the polygon actually contains them.

Is there a better way to do this without using the sensors API?

janhohenheim avatar Feb 25 '19 23:02 janhohenheim

@jnferner This is indeed not yet possible without perhaps inserting a new sensor and see what touched it after one step.

This is a feature we could add to ncollide though. The approach would be essentially the same as what you already did, except for the step 3 where we would have to use our narrow-phase proximity algorithm dispatcher to select the right implementation for the test.

sebcrozet avatar Mar 02 '19 12:03 sebcrozet