- Home /
instantiate objects within an area
how can I instantiate objects within an area?
The area is referencing a list of points, such as the one in the image, which may vary in the number of points. the list of points is already created, I even generate a mesh, triangulating the points instantiated in each click.
but I wonder how I can instantiate objects within that area.
it occurred to me to instantiate objects within a trigger (which would be attaching a collider to the mesh created) but it did not work, or maybe I did it wrong.
any ideas?
sorry deleted my answer- it only applied to convex outlines
if you have a mesh, I assume you have a triangle array. check each start-point against each triangle: https://stackoverflow.com/questions/2049582/how-to-deter$$anonymous$$e-if-a-point-is-in-a-2d-triangle
p.s. If you meant VOLU$$anonymous$$E(3d) not AREA(2d), this would not work (and question should be clarified)