Merge pull request #16 from qiqian/master

calculate off-mesh-connection height correctly
This commit is contained in:
Mikko Mononen 2014-02-21 10:33:01 +02:00
commit bad6c17182

View File

@ -662,8 +662,8 @@ dtStatus dtNavMeshQuery::getPolyHeight(dtPolyRef ref, const float* pos, float* h
{ {
const float* v0 = &tile->verts[poly->verts[0]*3]; const float* v0 = &tile->verts[poly->verts[0]*3];
const float* v1 = &tile->verts[poly->verts[1]*3]; const float* v1 = &tile->verts[poly->verts[1]*3];
const float d0 = dtVdist(pos, v0); const float d0 = dtVdist2D(pos, v0);
const float d1 = dtVdist(pos, v1); const float d1 = dtVdist2D(pos, v1);
const float u = d0 / (d0+d1); const float u = d0 / (d0+d1);
if (height) if (height)
*height = v0[1] + (v1[1] - v0[1]) * u; *height = v0[1] + (v1[1] - v0[1]) * u;