This commit is contained in:
aozhiwei 2023-03-09 15:03:44 +08:00
commit a1c661444d
2 changed files with 27 additions and 2 deletions

View File

@ -2907,11 +2907,35 @@ 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
) {
#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)
{
@ -2970,6 +2994,7 @@ void Creature::ShotFindPath()
GetMutablePos().FromGlmVec3(left_new_point);
}
}
#endif
}
}

View File

@ -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: