Bug in rcFilterLedgeSpans causing voxels along walls to be filtered too?

52 views
Skip to first unread message

charlesj...@gmail.com

unread,
Dec 17, 2020, 6:20:47 PM12/17/20
to recastnavigation
Line 144 checks the abs of the span differences and compares it to walkableClimb.  This will cause it to filter ledges as well as up against a wall.  This seems like a bug as the point of this function is to erode away from ledges and prevent AI from going off of them.

I have locally edited this code to the below and have found the results to be quite good:
if ((nbot - bot) <= -walkableClimb)

This ensures that we only track asmin and asmax when there is a dropoff, not the edge of a wall.

Has anyone else ran into this?

Evgeny Adamenkov

unread,
Dec 17, 2020, 11:26:31 PM12/17/20
to recastna...@googlegroups.com
> Line 144 checks the abs of the span differences and compares it to walkableClimb.  This will cause it to filter ledges as well as up against a wall.

As far as I can see, this is not what is happening there, and also the comment in line 79 is not correct (/// A span is a ledge if: <tt>rcAbs(currentSpan.smax - neighborSpan.smax) > walkableClimb</tt>).

Only ledges are filtered, in lines 154-159, just like what you want:
// The current span is close to a ledge if the drop to any
// neighbour span is less than the walkableClimb.
if (minh < -walkableClimb)
{
s->area = RC_NULL_AREA;
}

Remember that minh is updated in line 141 (minh = rcMin(minh, nbot - bot);)

So basically the code is already doing what you want, despite the misleading comment in line 79.

The lines 144-148 are not about ledge voxels, they are about too much difference in (the level of) accessible neighbours, for a situation like this:
--
  |
  |
  -X-
      |
      L

where the voxel X is in the middle of a steep slope.  With your proposed change, only dropoffs will be considered, so the code will only be able to catch sharp peaks, like this:
  X
 | |
 | |
|   |

(as far as I can tell).

Evgeny

--

---
You received this message because you are subscribed to the Google Groups "recastnavigation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to recastnavigati...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/recastnavigation/8e36f089-4a9e-4865-a478-a6ade6ae0d2an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages