This commit is contained in:
aozhiwei 2023-05-15 14:41:21 +08:00
parent e73f4389e1
commit fd14c02ac6
2 changed files with 7 additions and 1 deletions

View File

@ -2563,7 +2563,9 @@ void Creature::OnLand()
}
{
glm::vec3 center = GetPos().ToGlmVec3();
#if 0
room->map_instance->PtInHouse(GetPos().ToGlmVec3(), center);
#endif
room->map_instance->Scale(center);
glm::vec3 point;
bool ok = false;
@ -2587,6 +2589,7 @@ void Creature::OnLand()
abort();
#endif
} else {
room->map_instance->AdjustOnLandPoint(point);
room->map_instance->UnScale(point);
}
Global::Instance()->verify_set_pos = 1;
@ -2595,6 +2598,7 @@ void Creature::OnLand()
GetMovement()->ClearPath();
room->grid_service->MoveCreature(this);
#ifdef DEBUG
if (IsPlayer()) {
a8::XPrintf("OnLoad ok:%d pos:%f,%f,%f\n",
{
ok ? 1 : 0,
@ -2602,6 +2606,7 @@ void Creature::OnLand()
point.y,
point.z
});
}
#endif
}
if (IsAndroid()) {

View File

@ -1136,7 +1136,7 @@ void MapInstance::AdjustOnLandPoint(glm::vec3& point)
}
glm::vec3 orig = glm::vec3(point.x, 100.0f, point.z);;
glm::vec3 dir = glm::vec3(0.0f, 1.0f, 0.0f);
glm::vec3 dir = glm::vec3(0.0f, -1.0f, 0.0f);
const dtPoly* nearest_poly = nullptr;
float nearest_distance = 0.0f;
@ -1192,4 +1192,5 @@ void MapInstance::AdjustOnLandPoint(glm::vec3& point)
return;
}
glm::vec3 nearest_pt = orig + dir * nearest_distance;
point.y = nearest_pt.y;
}