How can I get the world position of a vertex of an object?

I am trying to use TransformDirection() and TransfromPoint() in order to get the world position of a mesh vert but I am only getting the position in an vector3 array of it on the object itself.

    Vector3[] meshVerts = gameobj.GetComponent<MeshFilter>().mesh.vertices;
    Vector3 vertPos = gameobj.transform.position + transform.TransformDirection(meshVerts[0]);

Is there any way I can get the transform.position of a vert?

TransformDirection is only for direction. Use TransformPoint, and don’t add the object’s position, since that’s what TransformPoint is doing anyway.

You can use the Mesh API to get the vertices of your mesh. Converting these local coordinates to world space is very easy - you just need to use Transform.TransformPoint:-


or there another way but the same outcome

public Vector3 GetVertexWorldPosition(Vector3 vertex, Transform owner)
        return owner.localToWorldMatrix.MultiplyPoint3x4(vertex);