raycast hit to relative location on collider?

This is the code I’m currently using:

if(Input.GetMouseButtonUp(0))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
int mask = ~(1 << 8);
RaycastHit col = Physics.RaycastAll(ray, 100f);
foreach(RaycastHit info in col)
{
GameObject hit = info.collider.transform.root.gameObject;
Debug.Log (“hit” + hit);
if(hit.name.ToLower() == “texture”)
{
Debug.Log(“hit texture”);

	}
}

}

What I want to do… is find the location on the plane I hit with the raycast. I need to know if I’m clicking towards the middle of the plane, or towards an edge.

So, If the ray hits a gameObject with the name “texture”, I want to see where on that gameObject the ray actually hit relative to the gameObject’s locations. This is strictly dealing with planes.

You can use the point in the RaycastHit and use InverseTransformPoint on the transform of the hit collider to get it in local coordinates if that’s what you need.