From 41a43cd4bc7d44220093b37cdf0e43c729781703 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 9 Mar 2023 14:12:25 +0800 Subject: [PATCH 1/3] 1 --- server/gameserver/creature.cc | 2 +- server/gameserver/creature.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index 0919c1ea..b907d31d 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -2907,7 +2907,7 @@ void Creature::UnSetBuffTag(int tag) buff_tags_.erase(tag); } -void Creature::ShotFindPath() +void Creature::ShortFindPath() { if (std::abs(GetMoveDir().x) > FLT_EPSILON || std::abs(GetMoveDir().z) > FLT_EPSILON diff --git a/server/gameserver/creature.h b/server/gameserver/creature.h index 3a793083..2dc69f46 100644 --- a/server/gameserver/creature.h +++ b/server/gameserver/creature.h @@ -327,7 +327,7 @@ class Creature : public MoveableEntity int GetBuffTag(int tag); void IncBuffTag(int tag, int val); void UnSetBuffTag(int tag); - void ShotFindPath(); + void ShortFindPath(); float GetSkillRaycastDistance(); protected: From c44e9bb468b431ce08240668958fbdc6a93fb5eb Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 9 Mar 2023 14:46:22 +0800 Subject: [PATCH 2/3] 1 --- server/gameserver/creature.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index b907d31d..af127850 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -2912,6 +2912,9 @@ void Creature::ShortFindPath() if (std::abs(GetMoveDir().x) > FLT_EPSILON || std::abs(GetMoveDir().z) > FLT_EPSILON ) { +#if 1 + glm::vec3 start_pos = GetPos().ToGlmVec3() + GetMoveDir() * -1.0f * 2.0f; +#else auto try_move = [this] (glm::vec3& new_move_dir, bool& block, glm::vec3& new_point, float& distance) { @@ -2970,6 +2973,7 @@ void Creature::ShortFindPath() GetMutablePos().FromGlmVec3(left_new_point); } } +#endif } } From 847ad9b1dc0f6ef992ec8e22ef17c4e6e401351d Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 9 Mar 2023 15:01:31 +0800 Subject: [PATCH 3/3] 1 --- server/gameserver/creature.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index af127850..837b9894 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -2913,7 +2913,28 @@ void Creature::ShortFindPath() std::abs(GetMoveDir().z) > FLT_EPSILON ) { #if 1 + auto try_move = + [this] (glm::vec3 start, glm::vec3 end, + bool& block, glm::vec3& new_point, float& distance) + { + room->map_instance->Scale(start); + room->map_instance->Scale(end); + + glm::vec3 hit_point; + bool hit_result = false; + bool ret = room->map_instance->Raycast(start, end, hit_point, hit_result); + if (ret) { + } else { + block = true; + } + }; + glm::vec3 start_pos = GetPos().ToGlmVec3() + GetMoveDir() * -1.0f * 2.0f; + for (float angle = 30.0f; angle < 90.0f; angle += 30.0f) { + glm::vec3 move_dir = GetMoveDir(); + GlmHelper::RotateY(move_dir, angle); + glm::vec3 end_pos = start_pos + move_dir * 80.0f; + } #else auto try_move = [this] (glm::vec3& new_move_dir, bool& block, glm::vec3& new_point, float& distance)