Search Unity

Dynamic Obstacle Avoidance

Discussion in 'Assets and Asset Store' started by username_unity_of_my, Apr 25, 2017.

  1. username_unity_of_my

    username_unity_of_my

    Joined:
    Feb 24, 2015
    Posts:
    330
    BasicObstacleAvoidance component is just an example how to use avoidance and its used only on that demo scene.
    Every demo scene has different example components ( BasicObstacleAvoidance ( basic), CharacterObstacleAvoidanceAgent ( example of usage with nav mesh agent ), CharacterObstacleAvoidance( example without nav mesh agent ), PatrolAI( patrolling bot ))
    They are just examples.
    Actual avoidance is in 'ObstacleManager' class.

    My thought was that everybody will make their own controllers anyway.

    I thought is easier to add snippet of code at the end of your movement code and modify avoidance velocity than to create additional special component which will just use that same snippet. Its easier on performance too.
     
  2. Milionario

    Milionario

    Joined:
    Feb 21, 2014
    Posts:
    138
    Well I just tried using BasicObstacleAvoidance to try and mimic the example scene, it should just work.

    Here is what I tried:
    - Added ObstacleManager to scene
    - Added BasicObstacleAvoidance to a cube.
    - Added a NavMeshSurface tha bakes in runtime

    and

    it doesnt move.
     
  3. username_unity_of_my

    username_unity_of_my

    Joined:
    Feb 24, 2015
    Posts:
    330
    BasicObstacleAvoidance should be put on bots ( npcs ) which will make avoidance.
    Also did you populate scene with obstacles ( objects with 'Obstacle' component ) ?

    If you'd like I can make a video for you.
    Its pretty the same as what you did, I just put Bot with BasicObstacleAvoidance component and populate with some objects with 'Obstacle' component.

    EDIT:
    Dont forget to assign target to bot.
     
    Last edited: Feb 25, 2021