diff options
author | Jeremy <Golrag@users.noreply.github.com> | 2018-02-16 20:59:19 +0100 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2018-02-16 20:59:19 +0100 |
commit | 9e0faace9a5114fc2324c2c601ba943272e0d6ff (patch) | |
tree | ee7cb56b687598c96d5e967d8f8857fc5cee8b07 /src/common/Collision/DynamicTree.cpp | |
parent | 8aa10f6c65ba7fc8363a663b305fede95d0ccb58 (diff) |
Core/Entities: Reduce the probability of units dropping under the map (#21322)
Reduce the probabilty of going under the map
Diffstat (limited to 'src/common/Collision/DynamicTree.cpp')
-rw-r--r-- | src/common/Collision/DynamicTree.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/common/Collision/DynamicTree.cpp b/src/common/Collision/DynamicTree.cpp index 96378ef9c0d..a69d54c7f9a 100644 --- a/src/common/Collision/DynamicTree.cpp +++ b/src/common/Collision/DynamicTree.cpp @@ -254,3 +254,16 @@ float DynamicMapTree::getHeight(float x, float y, float z, float maxSearchDist, else return -G3D::finf(); } + +float DynamicMapTree::getCeil(float x, float y, float z, float maxSearchDist, uint32 phasemask) const +{ + G3D::Vector3 v(x, y, z); + G3D::Ray r(v, G3D::Vector3(0, 0, 1)); + DynamicTreeIntersectionCallback callback(phasemask); + impl->intersectZAllignedRay(r, callback, maxSearchDist); + + if (callback.didHit()) + return v.z + maxSearchDist; + + return G3D::finf(); +} |