官方例图
测试:
code:
public Transform point1;public Transform point2;public Transform humanPoint;public Transform targetPoint;void Start(){}void Update(){ targetPoint.position = point1.position + Vector3.Project(humanPoint.position - point1.position, point2.position - point1.position);}
官方论坛扩展阅读