「近づいてきたら逃げる」の編集履歴(バックアップ)一覧はこちら
近づいてきたら逃げる - (2015/04/01 (水) 23:58:04) の1つ前との変更点
追加された行は緑色になります。
削除された行は赤色になります。
void OnTriggerStay(Collider other)
{
Vector3 dir = this.transform.position - other.transform.position;
Vector3 pos = this.transform.position + dir * 0.5f;
agent.destination = pos;
}
dirは、thisからotherのベクトル
posにthisがotherから逃げる方向の目的地がセットされる
void OnTriggerStay(Collider other)
{
Vector3 dir = this.transform.position - other.transform.position;
Vector3 pos = this.transform.position + dir * 0.5f;
agent.destination = pos;
}
dirは、thisからotherのベクトル
posにthisがotherから逃げる方向の目的地がセットされる