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 navigate the site we have posted a site navigation 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.
Answers and Comments
11 People are following this question.
Math - calculate position in world space from ray on infinite plane
Dynamic Alpha Gradient Texture Collision Detection
Dragging a Camera along a plane / Where's the error?
raycasting throught the back of plane