1
This commit is contained in:
parent
b31f6cdd24
commit
2a8cbcc140
@ -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",
|
||||
|
@ -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;
|
||||
|
||||
|
@ -35,7 +35,7 @@ class MapInstance : public std::enable_shared_from_this<MapInstance>
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user