diff --git a/src/engine/surface_collision.c b/src/engine/surface_collision.c index f7678f78..d3cf1e4e 100644 --- a/src/engine/surface_collision.c +++ b/src/engine/surface_collision.c @@ -851,7 +851,11 @@ void find_surface_on_ray_list(struct SurfaceNode *list, Vec3f orig, Vec3f dir, f // Reject surface if out of vertical bounds if (list->surface->lowerY > top || list->surface->upperY < bottom) continue; - + + // Reject no-cam collision surfaces + if (gCheckingSurfaceCollisionsForCamera && (list->surface->flags & SURFACE_FLAG_NO_CAM_COLLISION)) + continue; + // Check intersection between the ray and this surface if ((hit = ray_surface_intersect(orig, dir, dir_length, list->surface, chk_hit_pos, &length)) != 0) { @@ -921,7 +925,7 @@ void find_surface_on_ray(Vec3f orig, Vec3f dir, struct Surface **hit_surface, Ve } // increase collision checking precision (normally 1) - f32 precision = 5; + f32 precision = 3; // Get cells we cross using DDA if (absx(dir[0]) >= absx(dir[2])) diff --git a/src/game/bettercamera.inc.h b/src/game/bettercamera.inc.h index f9da431d..d73fdaf1 100644 --- a/src/game/bettercamera.inc.h +++ b/src/game/bettercamera.inc.h @@ -10,6 +10,7 @@ #include "engine/surface_collision.h" #include "pc/configfile.h" #include "pc/controller/controller_mouse.h" + #if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) //quick and dirty fix for some older MinGW.org mingwrt #else @@ -18,7 +19,7 @@ #define NEW_CAM_BOUNDING_BOX_RAYS 4 #define NEW_CAM_BOUNDING_BOX_HRADIUS 250 -#define NEW_CAM_BOUNDING_BOX_VRADIUS 50 +#define NEW_CAM_BOUNDING_BOX_VRADIUS 100 /** Quick explanation of the camera modes @@ -527,6 +528,7 @@ static void newcam_collision(void) { camdir[2] = newcam_pos[2]-newcam_lookat[2]; find_surface_on_ray(newcam_pos_target, camdir, &surf, hitpos); + newcam_coldist = sqrtf((newcam_pos_target[0] - hitpos[0]) * (newcam_pos_target[0] - hitpos[0]) + (newcam_pos_target[1] - hitpos[1]) * (newcam_pos_target[1] - hitpos[1]) + (newcam_pos_target[2] - hitpos[2]) * (newcam_pos_target[2] - hitpos[2])); if (surf) {