This commit is contained in:
aozhiwei 2023-02-03 12:08:37 +08:00
parent 516d7357e1
commit ddcded1ada
2 changed files with 22 additions and 17 deletions

View File

@ -666,6 +666,28 @@ bool MapInstance::RaycastEx(int layer, const glm::vec3& start, const glm::vec3&
}
hit_pos_[1] = closest[1];
}
{
bool is_same_flags = true;
unsigned short last_flags = 0;
spec_polys.reserve(npolys);
for (int i = 0; i < npolys; ++i) {
unsigned short flags = 0;
status = navmesh_->getPolyFlags(polys_[i], &flags);
if (!dtStatusSucceed(status)) {
abort();
}
if (flags) {
if (last_flags && last_flags != flags) {
is_same_flags = false;
}
last_flags = flags;
spec_polys.push_back(flags);
}
}
if (is_same_flags) {
same_polys_flags = last_flags;
}
}
hit_point.x = hit_pos_[0];
hit_point.y = hit_pos_[1];

View File

@ -5,19 +5,6 @@
const int MAX_POLYS = 256;
struct HeightInfo
{
int t = 0;
int h = 0;
};
struct GridInfo
{
bool is_perfect = false;
std::vector<HeightInfo*> layers;
std::vector<std::list<HeightInfo*>> details;
};
class Entity;
class Obstacle;
class MapService;
@ -77,10 +64,6 @@ class MapInstance : public std::enable_shared_from_this<MapInstance>
std::vector<int> poly_ext_datas_;
int grid_width_ = 0;
int grid_height_ = 0;
std::vector<GridInfo> height_datas_;
std::string map_tpl_name_;
const mt::Map* map_meta_ = nullptr;
MapService* map_service_ = nullptr;