Skip to content

Re-orient entity collision box per sub-level and substep#1349

Open
minerguy341 wants to merge 1 commit into
ryanhcode:mainfrom
minerguy341:fix/entity-obb-per-sublevel-orientation
Open

Re-orient entity collision box per sub-level and substep#1349
minerguy341 wants to merge 1 commit into
ryanhcode:mainfrom
minerguy341:fix/entity-obb-per-sublevel-orientation

Conversation

@minerguy341

Copy link
Copy Markdown

The bug

Entities catch on walls and doorframes of sub-levels that are oriented at an angle — walking through a 1-wide doorway on a yawed contraption snags on the frame even though the entity's oriented collision box should clear it.

Root cause

In SubLevelEntityCollision.collide(), the entity's OBB yaw is computed at the top of the substep loop:

sink.entityBoxOrientation.identity();
final double yaw = getHitBoxYaw(subLevelPose);
sink.entityBoxOrientation.rotateY(yaw);

but subLevelPose is only assigned inside the per-sub-level loop (lastPose.lerp(logicalPose, i / substeps, subLevelPose)), i.e. after this read. The box is therefore oriented to the previous substep's pose — or, when several sub-levels are loaded, to a different sub-level entirely (whatever the reused sink held last). On rotated sub-levels the collision box is intermittently mis-yawed, which reads in-game as snagging on geometry the box should pass.

The fix

Recompute the box orientation inside the per-sub-level loop, immediately after the substep pose lerp, so every SAT test uses the orientation of the sub-level actually being collided at the current substep. The customEntityOrientation path is deliberately left on the original code path to avoid disturbing its up-direction and eye-height handling.

Testing

  • 1-wide doorway on a walkway attached to a swivel bearing, parked at an angle: walking through from both sides no longer catches on the frame (previously snagged repeatedly).
  • Same test with a second contraption assembled nearby (the worst case for the stale read): still clean.
  • Regression: flat/unrotated contraptions, spinning platforms (16–100+ RPM), and tilted decks behave as before.

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Jul 10, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@minerguy341 minerguy341 reopened this Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants