0

I just downloaded Unity 5.4 and I wanted to improve the car AI scene to learn how to use nav meshes.

But nothing works : the nav mesh on my terrain is OK, nav mesh obstacles carve the nav mesh but the agent on the car still doesn't avoid collisions.

I suspect it is because of the AI controller but I'm new at unity and I really don't know what to do...

In fact I'm trying to achieve what this guy made on this video :
https://www.youtube.com/watch?v=1uPmIyYzxxI

What I tried so far :

  • create boxes, assigned a Nav Mesh Obstacle to them
  • put the Nav Mesh on the car, but also in an empty object as advised in a comment of the above mentioned video
  • put the Nav Mesh on the WaypointTargetObject, as it is the object responsible for the trajectory
  • play with the settings
Cryborg
  • 303
  • 3
  • 14
  • 2
    This is fairly deep, the answer is complicated and probably not really suitable for Stack Overflow. You may need to make significant changes to the AI controller. I'd just start again. Setup a waypoint system that the car would follow. (There's some good tutorials on waypoints in the [stealth](https://unity3d.com/learn/tutorials/projects/stealth-tutorial-4x-only/enemy-ai) project ). Use the way points to update the target of the NavAgent, the when the agent reaches the way point set it to the next way point. This way it will navigate around the NavMesh on your track and the obstacles. – Rob Aug 19 '16 at 10:08
  • 2
    What @Rob said, but also: don't start with Cars. Cars in Unity are very complex objects, with some major nasty bugs in recent Unity versions (5.2,5.3, 5.4). Start with making a simple cube that follows a nav mesh - debug that, understand how navmeshes work in Unity ... then add more complexity, and build up to using cars. – Adam Aug 19 '16 at 12:38
  • Thank you for your answers ! I already played with simpler objects, even with the very same car I'm using now but without the AI controller, only a simple script and nav meshes and it works like charm. That is why I wanted to go a bit further and I feared I'd have to heavily modify the controller... – Cryborg Aug 19 '16 at 12:43

0 Answers0