#include "DetourExtended.h"
|
float | getCost (const float *pa, const float *pb, const dtPolyRef prevRef, const dtMeshTile *prevTile, const dtPoly *prevPoly, const dtPolyRef curRef, const dtMeshTile *curTile, const dtPoly *curPoly, const dtPolyRef nextRef, const dtMeshTile *nextTile, const dtPoly *nextPoly) const override |
|
◆ getCost()
float dtQueryFilterExt::getCost |
( |
const float * |
pa, |
|
|
const float * |
pb, |
|
|
const dtPolyRef |
prevRef, |
|
|
const dtMeshTile * |
prevTile, |
|
|
const dtPoly * |
prevPoly, |
|
|
const dtPolyRef |
curRef, |
|
|
const dtMeshTile * |
curTile, |
|
|
const dtPoly * |
curPoly, |
|
|
const dtPolyRef |
nextRef, |
|
|
const dtMeshTile * |
nextTile, |
|
|
const dtPoly * |
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: