Page 1 of 1

Slope question

Posted: 31 Jul 2008, 06:21
by RogerN
I'm a bit confused by pathing and slopes. I thought I understood this stuff, but now I'm not so sure...

Consider the hill to the left of my commander in this screenshot:

Image

It's plainly obvious that the hill is steeper than 36 degrees. It looks closer to 60 degrees, in fact. Yet my commander and k-bots can walk up it just fine. Why? I thought BA kbots were limited to slopes of 36?

All of my vehicles, however, are working exactly as I would expect them to. The areas which are steeper than 18 degrees (according to my slope map) are inaccessible.

Re: Slope question

Posted: 31 Jul 2008, 09:28
by Forboding Angel
It's not in degrees roger.

We call it, the spring magic slope system. Actually there is an explanation of it floating around, but tbh I'm just so used to it that I can't remember.

However your mistake is a common one. You aren't alone :-)

Re: Slope question

Posted: 31 Jul 2008, 13:04
by Kloot
Spring doesn't represent terrain slopes in degrees, internally it uses
(1.0 - the terrain normal's y-component) so the slope of vertical faces
is 1 and that of horizontal ones 0. A unit's maxSlope value (which is in
degrees in its movedef) is converted so that the "can we go here?" (ie
"maxSlope > terrainSlope?") comparisons are meaningful, the formula
is 1.0 - cos(DEG2RAD(maxSlope * 1.5)). If you want to know the terrain
angle in degrees, compute RAD2DEG(arccos(1.0 - terrainSlope)). For a
kbot with a maxSlope of 36 degrees (~0.41221 in "Spring format"), the
maximum tolerable terrain angle is approximately

RAD2DEG(arccos(1.0 - 0.41221))

or 54 degrees. If maxSlope was 30, the MTTA would be 45, and if it was
60 (the highest sensible value due to that 1.5 scalar and the absence
of overhanging cliffs) the kbot could mount any terrain. In other words
you do not need the long mathematical derivation, just remember that
maxTerrainAngle = maxSlope * 1.5. ;)

Re: Slope question

Posted: 31 Jul 2008, 14:38
by RogerN
Thanks a bunch. That explains it... I'll need to tweak my slope map generator to use Magic Spring Slope instead of degrees.