1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

NavMeshAgent同士の衝突でOnCollisionEnterが動作しない場合の対処法

Posted at

問題

NavMeshAgentがアタッチされている2つ以上のオブジェクトが衝突してもOnCollisionEnterが呼ばれない。

原因

  • NavMeshAgentを動かすためにはRigidbodyのisKinematicをオフにする必要がある
  • isKinematicがオフの物体同士の衝突ではOnCollisionEnterが呼ばれない

という2つの相反する要求が同時に発生しているからです。

解決法

  1. isKinematicをオンにする
  2. NavMeshAgentのMassを0 (厳密には1e-07)にする

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?