diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 1dea348e..7c06c6aa 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -2341,20 +2341,16 @@ void Human::OnLand() } #ifdef MAP3D { - a8::Vec3 center; - center.x = GetPos().x / 10; - center.z = GetPos().y / 10; - a8::Vec3 point; + glm::vec3 center = GetPos().ToGlmVec3(); + room->map_instance->Scale(center); + glm::vec3 point; bool ok = room->map_instance->FindNearestPoint(center, 2, point); if (!ok) { abort(); } - Position new_pos; - new_pos.x = point.x * 10; - new_pos.y = point.y; - new_pos.z = point.z * 10; + room->map_instance->UnScale(point); Global::Instance()->verify_set_pos = 1; - SetPos(new_pos); + GetMutablePos().FromGlmVec3(point); Global::Instance()->verify_set_pos = 0; #ifdef DEBUG a8::XPrintf("OnLoad ok:%d pos:%f,%f,%f\n", diff --git a/server/gameserver/mapinstance.cc b/server/gameserver/mapinstance.cc index 41c372d2..8ded8f89 100644 --- a/server/gameserver/mapinstance.cc +++ b/server/gameserver/mapinstance.cc @@ -534,7 +534,7 @@ bool MapInstance::Raycast(int layer, const glm::vec3& start, const glm::vec3& en return true; } -bool MapInstance::FindNearestPoint(const a8::Vec3& center, float radius, a8::Vec3& nearest_pt) +bool MapInstance::FindNearestPoint(const glm::vec3& center, float radius, glm::vec3& nearest_pt) { dtPolyRef startRef = INVALID_NAVMESH_POLYREF; diff --git a/server/gameserver/mapinstance.h b/server/gameserver/mapinstance.h index 03305ec0..ddec83e7 100644 --- a/server/gameserver/mapinstance.h +++ b/server/gameserver/mapinstance.h @@ -35,7 +35,7 @@ class MapInstance : public std::enable_shared_from_this glm::vec3& random_pt); bool Raycast(int layer, const glm::vec3& start, const glm::vec3& end, glm::vec3& hit_point, bool& hit_result); - bool FindNearestPoint(const a8::Vec3& center, float radius, a8::Vec3& nearestPt); + bool FindNearestPoint(const glm::vec3& center, float radius, glm::vec3& nearestPt); bool GetPosHeight(const Position& pos, float& out_height); void Scale(glm::vec3& v); void UnScale(glm::vec3& v);