Reported by our users on discord and brought to our attention by [Internal link]]:
Description of the issue:
There was a discussion on discord about unexpected behaviours related to raycasts and shape casts. 3 inconsistencies/issues were brought up:
- There are no backface hits for convex colliders (primitives or meshes), but there are backface hits for non-convex colliders
- (see [Internal link] ) the green upward spherecast hitting this non-convex plane mesh returns some red hit normals that point "upwards" (so dot(hitNormal, castDirection) > 0f )
- a spherecast hitting a convex plane mesh collider (same mesh as in the video, but set to convex) returns a hit, but a raycast doesn't. Could there be an issue with convex hull generation for meshes that are completely flat?
Note that some items in the list above might be expected behavior. We have to confirm which are, and which aren't.
Context: See thread here in #ext-unity-physics.
Potential solution:
- Fix the issue with raycasts on flat convex meshes not working (point 3 above).
- According to [Internal link], no matter which side the cast originates from, there is no hit.
- More information on the observed behavior:
- Collisions work: when putting a dynamic Rigidbody with a box collider over the convex plane collider, and letting it fall on it, the box does properly collide with the convex plane.
- Sphere casts work: a sphere cast detect hits on both sides against the convex plane collider
- Ray casts don't work:* a ray cast never detects hits on any side against the convex plane collider
- For the rest (1, 2), document the expected behavior.