世界坐标转本地坐标
transform.InverseTransformPoint()
本地坐标转世界坐标
transform.TransformPoint()
实例
鼠标点击物体, 获取点击点在物体上的坐标
var ray = Camera.main.ScreenPointToRay(UnityEngine.Input.mousePosition);
var hits = UnityEngine.Physics.RaycastAll(ray, 1024);
if (hits != null && hits.Length > 0)
{
var hit = hits[0];
var colliderHitPoint = hit.collider.transform.InverseTransformPoint(hit.point);
}