We are using UCrowdFollowingComponent and MoveTo AI Task on our AI.
Those AI have a relatively small MaxWalkSpeed.
We are using UCrowdFollowingComponent’s parameter avoidanceQueryMultiplier
(SetCrowdAvoidanceRangeMultiplier) in order to detect other agents from a greater distance, as the sampling points are more spread out.
In Detour, the avoidanceQueryMultiplier parameter is used to change the distance of the different sampling points compared to the character origin, so this helps the AI agent detect other agents from a greater distance while keeping a relatively small MaxWalkSpeed.
The problem we have is that the AI character(without any other agent around them) with avoidanceQueryMultiplier > 1 will tend not to go straight, it will not choose the sampling point that aligns best with its velocity, and as a result will not go straight to the MoveTo target.
We noticed that the scoring of the different sampling points in the Detour system uses velocities(vel, dvel) without this multiplier applied (avoidanceQueryMultiplier becoming vmult in DetourObstacleAvoidance.cpp)
When computing the score, some part of the score is based on the distance between the sampling point and the current velocity and desired velocity (vel and dvel).
As a result, for a similar velocity direction, the score will changed based on avoidanceQueryMultiplier.
If avoidanceQueryMultiplier is for example 2, sampling locations that are closer to the character gets a higher score because the location was scaled outward, but the velocities were unchanged.
The sampling location aligned with the velocity, but far from the character, will have a worse score than closer sampling locations that are slightly left or right.
We made a code change so that multiplier(vmult) is also applied to the velocities (vel, dvel) in order that the distance better reflects the actual score (vpen, vcpen) for each location.
My questions are:
- Have you seen similar issues?
- Do you think this is a safe change to make?
dtVscale(velMult, vel, vmult);
dtVscale(dvelMult, dvel, vmult);
const dtReal vpen = m_params.weightDesVel * (dtVdist2D(vcand, dvelMult) * m_invVmax);
const dtReal vcpen = m_params.weightCurVel * (dtVdist2D(vcand, velMult) * m_invVmax);
[Attachment Removed]