diff options
author | silver1ce <none@none> | 2010-01-06 12:15:02 +0200 |
---|---|---|
committer | silver1ce <none@none> | 2010-01-06 12:15:02 +0200 |
commit | f82d5cb3fcef169cf7a62f83935fa6d6b105589d (patch) | |
tree | 690e156be323518c0c2ad5372f01684097b5e2f7 /src/shared/vmap/VMapManager.cpp | |
parent | 4a0af0314ee066f37ecb2a7fb8096ae8180dc966 (diff) |
fixed the bug that GetVmapHeight returns incorrect height on terrains(flying units fall below map etc)
also unlocked max ray lenght for getHeight, by default it's 10 yards
--HG--
branch : trunk
Diffstat (limited to 'src/shared/vmap/VMapManager.cpp')
-rw-r--r-- | src/shared/vmap/VMapManager.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/shared/vmap/VMapManager.cpp b/src/shared/vmap/VMapManager.cpp index a059f267f2e..655bd77abfc 100644 --- a/src/shared/vmap/VMapManager.cpp +++ b/src/shared/vmap/VMapManager.cpp @@ -450,14 +450,14 @@ namespace VMAP */ //int gGetHeightCounter = 0; - float VMapManager::getHeight(unsigned int pMapId, float x, float y, float z) + float VMapManager::getHeight(unsigned int pMapId, float x, float y, float z, float ray_lenght) { float height = VMAP_INVALID_HEIGHT_VALUE; //no height if(isHeightCalcEnabled() && iInstanceMapTrees.containsKey(pMapId)) { Vector3 pos = convertPositionToInternalRep(x,y,z); MapTree* mapTree = iInstanceMapTrees.get(pMapId); - height = mapTree->getHeight(pos); + height = mapTree->getHeight(pos, ray_lenght); if(!(height < inf())) { height = VMAP_INVALID_HEIGHT_VALUE; //no height @@ -633,13 +633,12 @@ namespace VMAP //========================================================= - float MapTree::getHeight(const Vector3& pPos) + float MapTree::getHeight(const Vector3& pPos, float ray_lenght) { float height = inf(); Vector3 dir = Vector3(0,-1,0); Ray ray = Ray::fromOriginAndDirection(pPos, dir); // direction with length of 1 - float maxDist = VMapDefinitions::getMaxCanFallDistance(); - float dist = getIntersectionTime(ray, maxDist, false); + float dist = getIntersectionTime(ray, ray_lenght, false); if(dist < inf()) { height = (pPos + dir * dist).y; |