Check if a random point in in or out a mesh:how to???

I have to generate random points that must be inside a mesh (.obj): how can i do this??

Thanks in advance,
Mike.

Can do this with maths if your mesh is convex. If it’s offlline or not speed critical you could think about raycasting it from 6 directions and then:

  1. gather the collided points of the 6 raycasts
  2. check that each raycast didn’t reach your random point

This can still be broken for meshes with holes in them but it should work fine. It won’t be 100% though and its not the fastest route.

If unity has a meshes overlap function which supports meshes enclosed in meshes, use that. I’m still a newbie at unity.