Change head offset if crouched

This commit is contained in:
8dcc 2023-07-31 18:03:14 +02:00
parent 4bb21a4ca6
commit 83278b9983
1 changed files with 5 additions and 2 deletions

View File

@ -7,7 +7,7 @@
#include "../include/util.h"
/* Game units to add to the entity origin to get the head */
#define HEAD_OFFSET 65.f
#define HEAD_OFFSET 25.f
/* Scale factor for aim punch */
#define AIM_PUNCH_MULT 2
@ -52,7 +52,10 @@ static vec3_t get_closest_delta(vec3_t viewangles) {
continue;
/* TODO: Get bones origin instead of calculating from ent origin */
const vec3_t head_pos = vec_add(ent->origin, vec3(0, 0, HEAD_OFFSET));
vec3_t head_pos = ent->origin;
if (ent->curstate.usehull != 1) /* Get head if not crouched */
head_pos.z += HEAD_OFFSET;
if (!is_visible(local_eyes, head_pos)) /* We can't see player */
continue;