Mesh - Getting vertices position, relative to the current model.

Hello.

So as the title says, I am trying to get the position of the vertices on a model.
The problem is that the positions I get arent relative to the model.

I just get positions relative to (0, 0, 0)

NavMesh = this.gameObject.GetComponent<MeshFilter>().mesh;

foreach (Vector3 vert in NavMesh.vertices)
{
Debug.DrawRay(vert, Vector3.up * 0.05f, Color.green);
}

Anyone got a solution?

Try transform.TransformPoint() ? It’ll convert a point in local space to world space.

NavMesh = this.gameObject.GetComponent<MeshFilter>().mesh;

foreach (Vector3 vert in NavMesh.vertices)
{
	Debug.DrawRay(transform.TransformPoint(vert), Vector3.up * 0.05f, Color.green);
}

Ofcourse! Works like a charm…
Thanks alot…