Hello, I need to return a single vertex on a mesh in world coordinates “Vector3.Position()” I have tried using:
Vector3[] meshVerts = someRandomGameobject.GetComponent().mesh.vertices;
Vector3 vertPos = transform.TransformDirection(meshVerts[0]);
and
Vector3[] meshVerts = someRandomGameobject.GetComponent().mesh.vertices;
Vector3 vertPos = transform.TransformPoint(meshVerts[0]);
I am unable to return a vector3 in world coordinates with transform.TransformDirection() or transform.TransformPoint() Is this a bug for vertices or am I doing something wrong?
I am able to get the actual point in space by:
Vector3 vertPos = gamobj.transfomr.position + transform.TransformPoint(meshVerts[0]);
But this will not return the rotation, any help would be greatly appreciated! Thanks!
Here is the full code if you want to check it out:
public GameObject someRandomGameobject;
public void Start()
{
Vector3[] meshVerts = someRandomGameobject.GetComponent().mesh.vertices;
Vector3 vertPos = gameobj.transform.position + transform.TransfomrPoint(meshVerts[0]);
Debug.Log(vertPos);
}
Thanks!