android+unity游戏开发之求物体间的距离

     不卖关子,还是老样子,把代码奉上~~~

using UnityEngine;
using System.Collections;
public class test : MonoBehaviour {
	public GameObject a;
	public GameObject b;
	public Vector3 m;
	public Vector3 n;
	void Start () {}	
	void Update (){  
        
     m=a.transform.position;  
     n=b.transform.position;  
     print(Vector3.Distance(m,n));  
   } 
}





android+unity游戏开发之求物体间的距离_第1张图片

你可能感兴趣的:(android+unity游戏开发之求物体间的距离)