Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Agent vs Character Controller

Discussion in 'Navigation' started by mrCharli3, Dec 3, 2019.

  1. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    981
    If I have an animal that is wandering around, should I do that using the AI Agent, or should I do it using the Character controller? I keep seeing both used and not sure when to use what?
     
  2. vhman

    vhman

    Joined:
    Aug 13, 2018
    Posts:
    363
    If you need path finding - Agent. Agent have some build in movement, so it is not easy to override.
    Anyway, path can be found be NavMesh static class and moved by CharacterController.

    So - Agent moved by himself, CharacterController is moved by you.
    It depends on how much code you want to write.
     
    Thanitsak likes this.
  3. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    981
    Hmm, okay, so would you say that assets on the store that use Character controllers for AI are doing it wrong?
     
  4. vhman

    vhman

    Joined:
    Aug 13, 2018
    Posts:
    363
    No, they doesn't. You can use CaharacterController on top of NavMeshAgent, or any other AI.
    You can use Move() method form NavMeshAgent or CharacterController (both has it). Or use CharacterController to move NavMeshAgent.

     
    DwinTeimlon and mrCharli3 like this.