2 questions about Terrain(AI on terrain)

Hi there!

So I just have a couple questions.

  1. I made a waypoint script which makes my enemy walk towards it. Which works amazing. However… It also makes my enemies walk right through terrain to get to said waypoint. How can I make it so they can’t go through terrain and instead have to walk over hills or go down them.
  2. When I put on a Rigidbody and use gravity, they just fall through the terrain… I have a trigger collider but i need it. because its the hitbox

If you could help me that would be great!

Thank you!


Hi, in my opinion:

  1. Most optimized way of keeping any ai above the ground would be using single raycast down. From it you get terrain or other object hit point, and you can set needed height for object itself.
  2. Haven’t worked with a terrain for a while, as i remember there might be couple problems. First is, player is a bit inside/lower the terrain itself so it’s just falling through. Other was terrain and colliders related, there was something terrain didnt like about mesh colliders, but i think this is not the case.