#include "DetourExtended.h"
|
| float | getCost (float const *pa, float const *pb, const dtPolyRef prevRef, dtMeshTile const *prevTile, dtPoly const *prevPoly, const dtPolyRef curRef, dtMeshTile const *curTile, dtPoly const *curPoly, const dtPolyRef nextRef, dtMeshTile const *nextTile, dtPoly const *nextPoly) const override |
| |
◆ getCost()
| float dtQueryFilterExt::getCost |
( |
float const * |
pa, |
|
|
float const * |
pb, |
|
|
const dtPolyRef |
prevRef, |
|
|
dtMeshTile const * |
prevTile, |
|
|
dtPoly const * |
prevPoly, |
|
|
const dtPolyRef |
curRef, |
|
|
dtMeshTile const * |
curTile, |
|
|
dtPoly const * |
curPoly, |
|
|
const dtPolyRef |
nextRef, |
|
|
dtMeshTile const * |
nextTile, |
|
|
dtPoly const * |
nextPoly |
|
) |
| const |
|
override |
13{
14 float startX = pa[2], startY = pa[0], startZ = pa[1];
15 float destX = pb[2], destY = pb[0], destZ = pb[1];
16 float slopeAngle =
getSlopeAngle(startX, startY, startZ, destX, destY, destZ);
17 float slopeAngleDegree = (slopeAngle * 180.0f / M_PI);
18 float cost = slopeAngleDegree > 0 ? 1.0f + (1.0f * (slopeAngleDegree / 100)) : 1.0f;
19 float dist = dtVdist(pa, pb);
20 auto totalCost = dist * cost * getAreaCost(curPoly->getArea());
21 return totalCost;
22}
float getSlopeAngle(float startX, float startY, float startZ, float destX, float destY, float destZ)
Definition Geometry.h:40
References getSlopeAngle().
The documentation for this class was generated from the following files: