From 70f25939b6fab24243380a9a5c7cd2e34378b428 Mon Sep 17 00:00:00 2001 From: MysterD Date: Sun, 29 May 2022 16:43:35 -0700 Subject: [PATCH] Fix bettercam rotation when jumping --- src/game/bettercamera.inc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/bettercamera.inc.h b/src/game/bettercamera.inc.h index fef2bf97..20c8fe86 100644 --- a/src/game/bettercamera.inc.h +++ b/src/game/bettercamera.inc.h @@ -556,7 +556,7 @@ static void newcam_collision(void) { struct Surface *surf = NULL; Vec3f hitpos; - find_surface_on_ray(newcam_pos_target, camdir, &surf, hitpos); + find_surface_on_ray(newcam_lookat, camdir, &surf, hitpos); if (surf) { // offset the hit pos by the hit normal @@ -577,9 +577,9 @@ static void newcam_collision(void) { newcam_coldist = vec3f_dist(newcam_pos_target, hitpos); } else { - newcam_pos[0] = newcam_pos_target[0] + camdir[0]; - newcam_pos[1] = newcam_pos_target[1] + camdir[1]; - newcam_pos[2] = newcam_pos_target[2] + camdir[2]; + newcam_pos[0] = newcam_lookat[0] + camdir[0]; + newcam_pos[1] = newcam_lookat[1] + camdir[1]; + newcam_pos[2] = newcam_lookat[2] + camdir[2]; newcam_coldist = vec3f_length(camdir); } }