minor changes to grid walking

This commit is contained in:
k-a-z-u
2017-12-13 16:37:51 +01:00
parent 1114331fd2
commit d48b0b8fd4
7 changed files with 41 additions and 24 deletions

View File

@@ -111,14 +111,12 @@ public:
return Base::get(distance);
}
/** is the given position part of a floor (or in the air) */
bool isOnFloor(const float distance) const {
const Point3 pos = getPosAfterDistance(distance);
for (const Floorplan::Floor* floor : map->floors) {
const float delta = std::abs(floor->atHeight - pos.z);
if (delta < 0.1) {return true;}
}
return false;
/** at the given distance: are we walking on a plain surface or up/down? */
bool isPlain(const float distance) const {
const Point3 pos1 = getPosAfterDistance(distance);
const Point3 pos2 = getPosAfterDistance(distance + 0.1);
const float delta = std::abs(pos1.z - pos2.z);
return delta < 0.01;
}
};