This commit is contained in:
aozhiwei 2023-04-01 15:55:16 +08:00
parent dec6cf2cb3
commit 4b4daa509c
2 changed files with 19 additions and 3 deletions

View File

@ -3551,7 +3551,23 @@ bool Room::RandomSafeAreaPoint(glm::vec3& point)
return true; return true;
} }
bool Room::FindWalkablePointWithOutHouse(const glm::vec3& center, int try_count, int step, glm::vec3& point) bool Room::FindWalkablePointWithOutHouse(const glm::vec3& center, int try_count, int step, glm::vec3& out_point)
{ {
return false; glm::vec3 ref_point = center;
map_instance->PtInHouse(center, ref_point);
map_instance->Scale(ref_point);
glm::vec3 point;
bool ok = false;
for (int i = 0; i < try_count; ++i) {
ok = map_instance->FindNearestPoint(ref_point, 1.0f + step * i, point);
if (ok) {
break;
}
}
if (!ok) {
return false;
}
map_instance->UnScale(point);
out_point = point;
return true;
} }

View File

@ -218,7 +218,7 @@ public:
int GetPolyExtFlag(int poly_idx); int GetPolyExtFlag(int poly_idx);
size_t GetRoomMaxPlayerNum(); size_t GetRoomMaxPlayerNum();
bool RandomSafeAreaPoint(glm::vec3& point); bool RandomSafeAreaPoint(glm::vec3& point);
bool FindWalkablePointWithOutHouse(const glm::vec3& center, int try_count, int step, glm::vec3& point); bool FindWalkablePointWithOutHouse(const glm::vec3& center, int try_count, int step, glm::vec3& out_point);
private: private:
void ShuaAndroid(); void ShuaAndroid();