I used a tutorial to make a group of scripts for random land generation, and now I want to add objects onto the terrain, and I think that for rocks, if I get a triangle from the mesh, and instantiate a rock with the rotation and position of it, It will work. but I don’t know how to get the position and rotation of any gives triangle on any mesh.
With mesh colliders, I believe a raycast returns a triangle index of the triangle it hit. You can get the triangle array from the mesh filter’s mesh, and find the triangle that it hit. Then, use those as the indicies in the vertex array to find the vertices. Do some math, and you can get the pos/rot of that triangle.
Or use the normals. ![]()