summaryrefslogtreecommitdiff
path: root/src/game/world
diff options
context:
space:
mode:
authoraura <nw@moneybot.cc>2026-03-11 01:49:56 +0100
committeraura <nw@moneybot.cc>2026-03-11 01:49:56 +0100
commitbc1ea16c5be92e3bc810b0a30e01fbc9a7f191a9 (patch)
tree485edb847bcbf5e0b7618f76125f08bad6dfdf55 /src/game/world
parent4c0ab7a739085a32688f34947c0b1812a31d92d7 (diff)
final bsp fix perhaps?
Diffstat (limited to 'src/game/world')
-rw-r--r--src/game/world/trace.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/game/world/trace.cpp b/src/game/world/trace.cpp
index 2cf2a81..297ca16 100644
--- a/src/game/world/trace.cpp
+++ b/src/game/world/trace.cpp
@@ -331,13 +331,15 @@ U8 bsp_trace_sweep_aabb_to_leaf_edges(
VEC3 n = e->plane.normal;
F32 d = e->plane.dist;
F32 r = aabb_support_radius( hull, n );
+ if( n.z < 0.7f ) // this seems not necessary for ground for some reason lol
+ r += BSP_EDGE_TOLERANCE;
VEC3 dir = trace->in_end - trace->in_start;
F32 s0 = vec_dot( n, trace->in_start ) - d;
F32 ndir = vec_dot( n, dir );
if( ndir > 0.f ) continue;
- if( s0 <= -(r + BSP_TRACE_EPSILON) ) continue;
+ if( s0 <= -(r) ) continue;
F32 t_enter = ( r - s0) / ndir;
F32 t_exit = (-r - s0) / ndir;
@@ -431,6 +433,7 @@ U8 bsp_trace_sweep_aabb_to_leaf(
best = FLT_MAX;
U8 ehit = bsp_trace_sweep_aabb_to_leaf_edges( bsp, &edgehit, hull, leaf_idx, &best );
+
if( hit || ehit ) {
if( ehit && !hit )
*trace = edgehit;