This commit is contained in:
aozhiwei 2023-05-14 17:19:12 +08:00
parent 6dacb8c500
commit 162c98190d
3 changed files with 2 additions and 8 deletions

View File

@ -2567,18 +2567,12 @@ void Creature::OnLand()
room->map_instance->Scale(center);
glm::vec3 point;
bool ok = false;
#if 1
center = GetPos().ToGlmVec3();
room->map_instance->Scale(center);
ok = room->map_instance->FindOnLandPoint(center, point);
#else
for (int i = 0; i < 10; ++i) {
ok = room->map_instance->FindNearestPoint(center, 1.0f + 10 * i, point);
if (ok) {
break;
}
}
#endif
#if 1
if (point.y < 1.2) {
point.y = 3.0f;

View File

@ -1111,7 +1111,7 @@ bool MapInstance::GetNearestGrass(const glm::vec3& center, glm::vec3& out_pt)
return false;
}
bool MapInstance::FindOnLandPoint(const glm::vec3& center, glm::vec3& nearest_pt)
void MapInstance::AdjustOnLandPoint(glm::vec3& point)
{
}

View File

@ -48,7 +48,6 @@ class MapInstance : public std::enable_shared_from_this<MapInstance>
int& same_polys_flags, std::vector<dtPolyRef>& spec_polys,
unsigned short exclude_flags);
bool FindNearestPoint(const glm::vec3& center, float radius, glm::vec3& nearestPt);
bool FindOnLandPoint(const glm::vec3& center, glm::vec3& nearest_pt);
bool GetPosHeight(const Position& pos, float& out_height);
dtPoly* GetPoly(glm::vec3 pos, int& poly_idx);
void Scale(glm::vec3& v);
@ -60,6 +59,7 @@ class MapInstance : public std::enable_shared_from_this<MapInstance>
bool SceneRaycast(const glm::vec3& orig, const glm::vec3& dir, float max_distance,
glm::vec3& hit_pos, float& ray_length);
bool GetNearestGrass(const glm::vec3& center, glm::vec3& out_pt);
void AdjustOnLandPoint(glm::vec3& point);
private:
void LoadHouse();