How can I find if a point (Vector3) is inside of a mesh? Would this work for both concave and convex objects? I read somewhere that if you raycast in both directions of every axis (X, -X, Y, -Y, Z, -Z), take the count of the hits, and if it is even it is outside, if it is odd it is inside. I tried this and it didn't work.
Figured it out.
What you have to do is raycast from your point in any direction you want. Then, count how many times the raycast intersects with your mesh. If the count is an odd number, it is inside of the mesh. If it is even it is outside of it.
Since unity doesn't raycast on inside sides, you have to flip the faces in your 3d authoring tool. Then you have to raycast in the opposite direction to make up for the other side. (I haven't figured out how to get the count of hits from the raycast yet. But I am using a cube right now, which only has 2 perpendicular faces, so it works)
Unity C# code: