I need to get the vertex normals in a script but all of the normals look like they are pointing from the object’s origin. What am I missing?
var mesh : Mesh = GetComponent.<MeshFilter>().mesh;
var vertices : Vector3[] = mesh.vertices;
for (var i = 0; i < vertices.Length;i++)
{
var vertPosition: Vector3 = transform.TransformPoint(vertices[i]);
var vertNormal: Vector3 = transform.TransformDirection(vertices[i]);
Debug.DrawRay (vertPosition, vertNormal, Color.green);
}
Thanks!