dimforge / dimforge/ncollide

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

Open
#267 1 comment 0 reactions 0 assignees View on GitHub
enhancement P-medium
Dominant language
Rust
Stars
926
Forks
104
PR merge metrics
No merged PRs in 30d

Description

[CollisionWorld](https://www.ncollide.org/rustdoc/ncollide2d/world/struct.CollisionWorld.html) currently exposes methods for the retrieval of interferences with [a ray](https://www.ncollide.org/rustdoc/ncollide2d/world/struct.CollisionWorld.html#method.interferences_with_ray), [a point](https://www.ncollide.org/rustdoc/ncollide2d/world/struct.CollisionWorld.html#method.interferences_with_point) or [an AABB](https://www.ncollide.org/rustdoc/ncollide2d/world/struct.CollisionWorld.html#method.interferences_with_aabb). For my use-case however, I need to retrieve all objects that interfere with a [ConvexPolygon](https://www.ncollide.org/rustdoc/ncollide2d/shape/struct.ConvexPolygon.html).

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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.