From 0ba763b52e37f4020eb9659ca68cce3745f7fb22 Mon Sep 17 00:00:00 2001 From: Kieran Klukas Date: Wed, 1 Apr 2026 16:58:31 -0400 Subject: [PATCH] feat: maybe fix vertical obsticle checks --- physics_engine.vhd | 11 ++++++----- visualizer.py | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/physics_engine.vhd b/physics_engine.vhd index faf1b29..54e8ecd 100644 --- a/physics_engine.vhd +++ b/physics_engine.vhd @@ -301,17 +301,18 @@ begin c_top := py - SIZE11; c_bot := py + SIZE11; - -- Swept overlap: edge-crossing checks (prev and new extents straddle the face) + -- Swept overlap if vx(9) = '0' then - x_overlap := (c_right >= OBS_L(obs_i)) and (c_prev_right <= OBS_L(obs_i)); + x_overlap := (c_right >= OBS_L(obs_i)) and (c_prev_left <= OBS_R(obs_i)); else - x_overlap := (c_left <= OBS_R(obs_i)) and (c_prev_left >= OBS_R(obs_i)); + x_overlap := (c_prev_right >= OBS_L(obs_i)) and (c_left <= OBS_R(obs_i)); end if; + -- Strict y: exclude characters at/below bottom face (down) or at/above top face (up) if vy(9) = '0' then - y_overlap := (c_bot >= OBS_T(obs_i)) and (c_prev_bot <= OBS_T(obs_i)); + y_overlap := (c_bot >= OBS_T(obs_i)) and (c_prev_top < OBS_B(obs_i)); else - y_overlap := (c_top <= OBS_B(obs_i)) and (c_prev_top >= OBS_B(obs_i)); + y_overlap := (c_prev_bot > OBS_T(obs_i)) and (c_top <= OBS_B(obs_i)); end if; if x_overlap and y_overlap then diff --git a/visualizer.py b/visualizer.py index e2cef85..7b22754 100644 --- a/visualizer.py +++ b/visualizer.py @@ -249,13 +249,13 @@ def main(): c_top = py - SIZE; c_bot = py + SIZE if to_signed(vx) >= 0: - x_overlap = c_right >= ol and prev_right <= ol + x_overlap = c_right >= ol and prev_left <= orr else: - x_overlap = c_left <= orr and prev_left >= orr + x_overlap = prev_right >= ol and c_left <= orr if to_signed(vy) >= 0: - y_overlap = c_bot >= ot and prev_bot <= ot + y_overlap = c_bot >= ot and prev_top < ob else: - y_overlap = c_top <= ob and prev_top >= ob + y_overlap = prev_bot > ot and c_top <= ob if x_overlap and y_overlap: if prev_bot <= ot: -- 2.51.2