可以用 点乘 来判断物体是在人物的前方,还是后方,
用 叉乘 来判断是在人物的 左手边,还是右手边。
这里,显示的是红色的盒子和人物的相对 位置。
代码如下
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class NewBehaviourScript : MonoBehaviour {
public Text textA;
public Text textB;
public Text textLR;
public Text textFB;
public GameObject targetGameObject;
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI()
{