1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-18 19:01:45 +02:00

fix enemies collision (door bottleneck bug)

This commit is contained in:
XProger
2019-01-27 00:38:05 +03:00
parent 522123e72d
commit 420e7b88f9

View File

@@ -168,7 +168,7 @@ struct Enemy : Character {
if (enemy->health > 0.0f) { if (enemy->health > 0.0f) {
vec3 dir = vec3(enemy->pos.x - pos.x, 0.0f, enemy->pos.z - pos.z); vec3 dir = vec3(enemy->pos.x - pos.x, 0.0f, enemy->pos.z - pos.z);
float D = dir.length2(); float D = dir.length2();
float R = float(enemy->radius + radius); float R = float((enemy->radius + radius) / 2);
if (D < R * R) { if (D < R * R) {
D = sqrtf(D); D = sqrtf(D);
pos -= dir.normal() * (R - D); pos -= dir.normal() * (R - D);