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);