dimforge / ncollide

2 and 3-dimensional collision detection library in Rust.
https://ncollide.org
Apache License 2.0
921 stars 105 forks source link

3D: ray casts which touch a TriMesh edge report intersection with a backface #335

Open clbarnes opened 4 years ago

clbarnes commented 4 years ago

Here's a repo demonstrating the issue: https://github.com/clbarnes/ncollide-issue-graze

Imagine Santa's sled knocking some snow off the top of a roof. It could be argued that no impact happened, or it could be argued that the impact happened with the edge. ncollide3d reports that Santa collided with the inside of the house.

This is important for using ray casting to determine whether a point is inside a mesh. As per https://github.com/rustsim/ncollide/issues/317, I am casting a ray and checking whether it intersected with a backface. In the motivating example, a point nowhere near the mesh happens to cast a ray which skims a ridge in the mesh: due to this issue, a backface intersection is reported.

sebcrozet commented 3 years ago

Yeah, launching multiple rays sounds like a safe alternative for the time being.