I have a plane with a MeshCollider, and it has weird problems with raycasting. It seems that when I cast a ray from the top of the plane, it works fine. The raycast can detect that it hits the plane. But when I cast a ray from the bottom of the plane, it doesn't detect that it hits the plane. I drew a line and the ray should hit the plane.
When I change the MeshCollider to BoxCollider, the rays work correctly.
Is there any reason for this problem? How can can I shoot a ray from beneath the plane with a MeshCollider?
Answer by MountDoomTeam
Mar 09, 2013 at 08:52 AM
Hello, can you see the mesh from both sides? Yes Colliders are mostly made to work just in one direction, there may be a workaround for double sided planes, although in games they normally have 2 planes
Does it mean it will only work on the side with the normal vector pointing forward?
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users post good questions and use the site effectively we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
11 People are following this question.
How to hit two objects with only one shot (raycast)
Why do I get a triangleIndex of -1 when I SphereCast a convex MeshCollider?
raycasting throught the back of plane
Dragging a Camera along a plane / Where's the error?