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:
@@ -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);
|
||||||
|
Reference in New Issue
Block a user