Skip to content

Commit

Permalink
Fix normal direction for GJK ray casting inside non-solid shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jondolf authored and sebcrozet committed Mar 24, 2024
1 parent 5ad8d13 commit e05dba0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/query/ray/ray_support_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,14 @@ where
simplex.reset(CSOPoint::single_point(supp - new_ray.origin.coords));

gjk::cast_local_ray(shape, simplex, &new_ray, shift + eps).and_then(
|(toi, normal)| {
|(toi, outward_normal)| {
let toi = shift - toi;
if toi <= max_toi {
Some(RayIntersection::new(toi, normal, FeatureId::Unknown))
Some(RayIntersection::new(
toi,
-outward_normal,
FeatureId::Unknown,
))
} else {
None
}
Expand Down

0 comments on commit e05dba0

Please sign in to comment.