1
This commit is contained in:
parent
240a8ae02d
commit
7f9e47a881
@ -2941,6 +2941,34 @@ void Creature::ShortFindPath()
|
||||
int count = 0;
|
||||
|
||||
glm::vec3 start_pos = GetPos().ToGlmVec3() + GetMoveDir() * -1.0f * 2.0f;
|
||||
#if 1
|
||||
bool right_ok = false;
|
||||
float right_distance = 0.0f;
|
||||
{
|
||||
float angle = 1.0f;
|
||||
glm::vec3 move_dir = GetMoveDir();
|
||||
GlmHelper::RotateY(move_dir, angle);
|
||||
glm::vec3 end_pos = start_pos + move_dir * 80.0f;
|
||||
glm::vec3 new_point = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||
bool ret = try_move(start_pos, end_pos, new_point);
|
||||
if (ret) {
|
||||
right_ok = true;
|
||||
}
|
||||
}
|
||||
bool left_ok = false;
|
||||
float left_distance = 0.0f;
|
||||
{
|
||||
float angle = -1.0f;
|
||||
glm::vec3 move_dir = GetMoveDir();
|
||||
GlmHelper::RotateY(move_dir, angle);
|
||||
glm::vec3 end_pos = start_pos + move_dir * 80.0f;
|
||||
glm::vec3 new_point = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||
bool ret = try_move(start_pos, end_pos, new_point);
|
||||
if (ret) {
|
||||
left_ok = true;
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (float angle = 1.0f; angle < 90.0f; angle += 1.0f) {
|
||||
glm::vec3 move_dir = GetMoveDir();
|
||||
GlmHelper::RotateY(move_dir, angle);
|
||||
@ -2957,7 +2985,8 @@ void Creature::ShortFindPath()
|
||||
float last_distance = GlmHelper::Norm(last_pos - start_pos);
|
||||
float last_center_distance = GlmHelper::Norm(last_pos - GetPos().ToGlmVec3());
|
||||
if (curr_distance > last_distance) {
|
||||
|
||||
if (std::fabs(curr_distance - GetSpeed())) {
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
@ -2968,6 +2997,7 @@ void Creature::ShortFindPath()
|
||||
++count;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user