I’m trying to print a list of vertices. This code which I have written prints a list of vertice positions velative to the centre of the Object. How can I print the positions in global space?
function Start (){
var mesh1 : Mesh = GetComponent(MeshFilter).mesh;
var vertices : Vector3[] = mesh1.vertices;
var normals : Vector3[] = mesh1.normals;
for (var value : Vector3 in mesh1.vertices) {
var position1 = transform.TransformPoint(value);
print("mesh1 Vertice at " + position1);
}
var mesh2 : Mesh = object.GetComponent(MeshFilter).mesh;
var vertices2 : Vector3[] = mesh2.vertices;
var normals2 : Vector3[] = mesh2.normals;
for (var myValue : Vector3 in mesh2.vertices) {
var myPosition = transform.TransformPoint(myValue);
print("mesh2 Vertice at " + myPosition);
}
}
}