I have a custom mesh with attached mesh collider. It is concave by it’s nature (planet) and cannot be made convex. Also it is quite tricky to make it from multiple box colliders because of complexity.
I discovered that my raycasts with Physics.Raycast don’t hit this mesh/collider while other rigidbodies interact with it as usual.
Please advice what can I do to make Raycast working with mesh presicion on this collider.
Thank you in advance.
Possibly the normals of the collider are inverted? Not really sure what else might cause this, though I’d think collision wouldn’t work right in that case either. You sure your raycast includes the correct layer? I guess it’s possible that the mesh violates some rule(s) about mesh colliders; check the documentation.
A single mesh representing a roughly spherical planet is convex, not concave. If you have things like caves or geological formations with “holes through mountains” or something, I’m not sure what to call it…
In most situations, you’ll want to simplify your mesh colliders as much as possible. Stability and performance can often be improved by splitting complex mesh colliders into convex chunks.