Search Unity

Any way to access number of nearby avoidance neighbours, or otherwise if avoidance is occurring?

Discussion in 'Navigation' started by BenHymers, Apr 12, 2017.

  1. BenHymers

    BenHymers

    Joined:
    Dec 16, 2014
    Posts:
    30
    I'd like to know whether an agent has neighbours nearby, preferably by checking the number of neighbours, which must be getting set internally somewhere. Is this exposed anywhere?

    Alternatively, how would I go about checking whether collision avoidance is currently having an affect on the agent's movement? If I could check the desired velocity before and after collision avoidance, I could use their difference to infer it, but desiredVelocity is documented as being set *after* collision avoidance.

    Is it sufficient to check whether the vector to the steeringTarget is not colinear with the desiredVelocity? I suspect this will fail because of non-instant acceleration.
     
  2. Jakob_Unity

    Jakob_Unity

    Joined:
    Dec 25, 2011
    Posts:
    269
    The only indication you can get at the moment is to look at the angle between the desiredVelocity and the vector towards the steering target - and yes the would not always be useful - e.g. if one vector is zero, or the setup is symmetric (avoiding left/right in equal amounts).

    Can you tell more about the use case, knowing the avoidance ?
     
  3. BenHymers

    BenHymers

    Joined:
    Dec 16, 2014
    Posts:
    30
    Ok, I'll give that a go for now.

    The use case is that I have a simulation, currently using another navmesh library, and RVO for avoidance, which I want to replace with Unity navigation for various reasons. The simulation can get very crowded (corridors with agents moving both ways), so to avoid deadlocks I temporarily disable avoidance for agents detected to be stuck against other agents, to allow them to 'ghost' through problem areas. The 'is stuck avoiding' calculation is simply 'stopped for a while' and 'has avoidance neighbours'. I can't replace that last part yet. This is something easily accessible in DetourCrowd.

    For now I'll do the best I can with the steering target, which might end up being enough since I have a fair timeout on the 'is stopped' calculation - thanks.
     
  4. BenHymers

    BenHymers

    Joined:
    Dec 16, 2014
    Posts:
    30
    Actually, while I have your attention - are you looking after navigation in Unity nowadays? I take it Mikko left Unity last year so I can't request things from him :) I have a few other small feature requests, how would I go about making those?

    I'm a maintainer on Recast/Detour, and have worked in AI for a long time, so don't worry, they'll only be sensible and feasible requests :)