I have gameobjects in my scene called icospheres that I have made in Blender, and I am trying to get the coordinates of their vertices. Below is an image of my scene; each triangle is a separate gameobject, blender mesh and is called an icosphere:
Here is the code I am using:
var meshFilter = icosphere.GetComponent<MeshFilter>(); var vertices = meshFilter.mesh.vertices; GameObject.Find("Fauna Manager").GetComponent<FaunaManager>().PlaceFauna(tree, vertices[0], icosphere); GameObject.Find("Fauna Manager").GetComponent<FaunaManager>().PlaceFauna(tree, vertices[1], icosphere); GameObject.Find("Fauna Manager").GetComponent<FaunaManager>().PlaceFauna(tree, vertices[2], icosphere); The bottom 3 lines of code call a function that should in theory place another gameobject on top of the 3 coordinates that have been calculated above, however this does not happen. The tree-placing functions work completely and have been tested so the problem is definitely with the coordinates. I printed out the coordinates and the length of the array that holds them. The array is of length 3 as it should be however the coordinates are completely off. The trees have been placed a long way away from the icosphere which means the coordinates are clearly wrong. Where have I gone wrong?
example of coordinates: -0.1, 0.0, -0.1 centre of icosphere for reference: -0.7431812, 0.4044746, -4.932096 Above you can see that the coordinates are well off
