Saturday 1 November 2014

Unity navMesh and rigidbodies

If you ever made navigation with navMesh you probably noticed that navMesh agent won't itteract with Unity physics. NavMeshAgent came through the rigidbodies without any problem. But there is a solution. Calculate path by calling static method of NavMesh.CalculatePath(from,destination, layer, path) then if method returns true, get second point of the path and apply force to your agent in that direction. Do it in every update. That's it. You even can not set navMesh agent, but be carefull with navMesh layer.

No comments:

Post a Comment