Skip to content

Stabilize player/obstacle collision resolution in Commit Dash - #5

Draft
leereilly with Copilot wants to merge 2 commits into
mainfrom
copilot/claude
Draft

Stabilize player/obstacle collision resolution in Commit Dash#5
leereilly with Copilot wants to merge 2 commits into
mainfrom
copilot/claude

Conversation

Copilot AI commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Collision handling was intermittently unstable: collisions were resolved against stale obstacle positions, and overlap tie cases could flip resolution axes frame-to-frame. This update makes collision resolution deterministic and aligned with current world positions.

  • Update order: resolve against current obstacle positions

    • Move world scrolling ahead of grounded/collision checks in update() so collision math runs on the latest tile coordinates.
  • Deterministic overlap resolution

    • Replace strict min-overlap equality checks with explicit horizontal vs vertical overlap comparison.
    • Introduce a small axis bias (COLLISION_AXIS_BIAS) to prefer vertical resolution in near-tie cases, reducing edge jitter/clipping.
  • Configuration clarity

    • Add GAME_CONFIG.COLLISION_AXIS_BIAS and use it in checkGrounded() instead of an inline magic number.
const minHorizontalOverlap = Math.min(overlapLeft, overlapRight);
const minVerticalOverlap = Math.min(overlapTop, overlapBottom);
const shouldResolveVertically =
  minVerticalOverlap <= (minHorizontalOverlap + GAME_CONFIG.COLLISION_AXIS_BIAS);

if (shouldResolveVertically) {
  // top/bottom resolution
} else {
  // side resolution
}

Copilot AI changed the title Stabilize collision detection in Commit Dash Stabilize player/obstacle collision resolution in Commit Dash Jul 24, 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