Page 1 of 1

Calculation of Slope/Passability

Posted: 31 May 2011, 20:45
by fc14159
As far as I know, maps are ultimately composed of right isosceles triangles, whose vertices are defined by the heightmap, like this:
square.jpg
square.jpg (16.3 KiB) Viewed 725 times
My question is how slope/passability are calculated. Is a slope defined for each triangle, or each square? Are the slopes calculated from the edges, or the faces?
Note: I need to know this for more than just testing for passability, so please don't tell me to just use tools to see the passability or whatever.

Re: Calculation of Slope/Passability

Posted: 02 Jun 2011, 20:09
by hoijui
from rts/ExternalAI/Interface/SSkirmishAICallback.h:

Code: Select all

The values are 1 minus the y-component of the (average) facenormal of the square.