1
This commit is contained in:
parent
7cee55b4ca
commit
d24b0201d6
@ -3576,21 +3576,22 @@ void Creature::ActivateTargetValidPos()
|
||||
glm::vec3 dir = GetPos().ToGlmVec3() - context_pos.ToGlmVec3();
|
||||
GlmHelper::Normalize(dir);
|
||||
dir.y = 0;
|
||||
while (distance > 10) {
|
||||
|
||||
}
|
||||
if (distance > 600 || distance < 10) {
|
||||
bool found = false;
|
||||
glm::vec3 found_pos;
|
||||
{
|
||||
float move_len = 0;
|
||||
while (move_len + 10 < distance) {
|
||||
glm::vec3 center = context_pos.ToGlmVec3() + dir * move_len;
|
||||
room->map_instance->Scale(center);
|
||||
|
||||
} else {
|
||||
glm::vec3 center = context_pos.ToGlmVec3();
|
||||
room->map_instance->Scale(center);
|
||||
|
||||
glm::vec3 point;
|
||||
bool ok = room->map_instance->FindConnectableNearestPoint(center, 0.3f, point);
|
||||
if (ok) {
|
||||
room->map_instance->UnScale(point);
|
||||
target_valid_pos = point;
|
||||
} else {
|
||||
bool ok = room->map_instance->FindConnectableNearestPoint(center, 0.3f, found_pos);
|
||||
if (ok) {
|
||||
room->map_instance->UnScale(found_pos);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
move_len += 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user