From eef49c3ec26dc18bda99299679995989fdea2495 Mon Sep 17 00:00:00 2001 From: minerguy341 Date: Thu, 9 Jul 2026 19:54:42 -0400 Subject: [PATCH] Re-orient entity collision box per sub-level and substep The entity's OBB yaw was computed from subLevelPose before that variable is assigned for the current substep and sub-level, so the collision box was oriented to the previous substep's pose - or to a different sub-level entirely when several are loaded. On rotated sub-levels this makes entities catch on walls and doorframes that their (correctly oriented) box should clear. Compute the orientation inside the per-sub-level loop, right after the substep pose lerp. The custom-entity-orientation path is left as-is to avoid disturbing the up-direction handling. Co-Authored-By: Claude Fable 5 --- .../entity_collision/SubLevelEntityCollision.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/src/main/java/dev/ryanhcode/sable/sublevel/entity_collision/SubLevelEntityCollision.java b/common/src/main/java/dev/ryanhcode/sable/sublevel/entity_collision/SubLevelEntityCollision.java index fdd62eab..c7c8cbc0 100644 --- a/common/src/main/java/dev/ryanhcode/sable/sublevel/entity_collision/SubLevelEntityCollision.java +++ b/common/src/main/java/dev/ryanhcode/sable/sublevel/entity_collision/SubLevelEntityCollision.java @@ -207,6 +207,16 @@ public static CollisionInfo collide(final Entity entity, final Vec3 collisionMot lastPose.lerp(logicalPose, (double) (i - 1) / substeps, lastSubLevelPose); lastPose.lerp(logicalPose, (double) (i) / substeps, subLevelPose); + // Re-orient the entity's collision box to THIS sub-level's pose at THIS substep. + // The computation before the loop reads subLevelPose before it has been set for the + // current iteration, so the box was oriented to the previous substep's pose — or to + // a different sub-level entirely — making entities catch on walls and doorframes of + // rotated sub-levels. + if (customEntityOrientation == null) { + sink.entityBoxOrientation.identity().rotateY(getHitBoxYaw(subLevelPose)); + entityBoundsOBB.setOrientation(sink.entityBoxOrientation); + } + rotatedContextBounds.set(fullContextBounds); if (customEntityOrientation != null) { entityBoundsOBB.vertices(sink.a);