Re-orient entity collision box per sub-level and substep#1349
Open
minerguy341 wants to merge 1 commit into
Open
Re-orient entity collision box per sub-level and substep#1349minerguy341 wants to merge 1 commit into
minerguy341 wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:but
subLevelPoseis 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
customEntityOrientationpath is deliberately left on the original code path to avoid disturbing its up-direction and eye-height handling.Testing
🤖 Generated with Claude Code