# Recast fiddly on slopes, advice needed

Hello, I’m using a recast graph and have noticed it’s quite fiddly to get it working with slopes.

Example:
Place a bunch of 20x5x10 cubes in the scene, rotated from 0 to 90 degrees in 5 degree increments about Z axis. On your recast graph, set the cell size to 0.5, and max slope to 89.

Now play with Walkable Climb and Cell Height. Some interesting ones to try:
Walkable Climb: 0.5, Cell Height 0.2, 0.25, 0.4, 0.5, 0.6. – Pay attention to the 30 degree cube
Walkable Climb: 1.0, Cell Height 0.2, 0.3, 0.4, 0.5, 0.6 – Pay attention to the 40 and 45 degree cubes.

As you can hopefully see, sometimes we’ll get a path generated up the slope, sometimes not, sometimes we’ll get part of the slope, or chunks along it…

All of these values have tradeoffs, of course, but it’s not clear to me how I can optimize for slopes, or that I even can. It feels like I can’t trust the recast scan to reliably get all slopes in any configuration, even ones that involve unreasonable values for cell or climb.

Can anyone suggest an approach to tuning these values that gives reliable results? Bear in mind, looking at these screenshots, that the max slope is 89.

Thanks!

Hi

A recast graph voxelizes the world (think minecraft, but much smaller blocks), so looking at those boxes from the side, it could look something like this:

`

XXXX______XXXX_______XXXX________XXXX
XXXX_____XXXX_______XXXX_______XXXX
XXXX_____XXXX______XXXX_______XXXX

XXXX____XXXX______XXXX______XXXX
______

`

Note that the slope is slightly different at different parts of it.
The recast graph does some smoothing, but it cannot eliminate everything.

The max slope is much more effective since it knows the exact slope of a single triangle when rasterizing it.

Max climb is just how much the character can climb between two voxels, so setting it at a too low value will make it something like a max slope limit, but with lower precision (see ascii image).

The cell height is basically the resolution along the Y axis, so decreasing it will increase the resolution (along the Y axis). I suggest that you do that to minimize rasterization artefacts.

Hi Aron,

Thanks for the reply! The diagram really cleared it up.

It seems my problem is just the rise over run of the cell sizes: If I have a cell size of .5, no matter what I change the cell height to, a 30 degree slope requires a lot of Walkable Climb because of how much the height of the ramp increases over .5 units horizontally!

So basically, the solution involved decreasing both cell size and cell height, until the resolution was fine enough for Walkable Climb to be the limiting factor.

This is still not ideal because now the grid is much finer than it really ought to be, but at least it makes sense now!