Skip to content

[Audit][Medium] hit_ceiling boolean set on downward Y movement when passing through collisionΒ #734

Description

@MichaelFisher1997

πŸ” Module Scanned\n (automated audit scan)\n\n## πŸ“ Summary\nIn , the flag is incorrectly set when the player's Y velocity is negative (falling/jumping down) and their downward movement is blocked by collision. This is backwards - hitting a ceiling means moving upward into an overhead block. The flag should only be set when Y velocity is positive (moving up), not when falling.\n\n## πŸ“ Location\n- File: \n- Function/Scope: Y-axis collision resolution (line 76-98)\n\n## πŸ”΄ Severity: Medium\n- Medium: Performance degradation, missing error handling, suboptimal patterns\n- This is a logic bug where the flag is set incorrectly\n\n## πŸ’₯ Impact\nWhen a player falls and hits the ground, will be instead of . This causes:\n- Incorrect game logic that checks (e.g., to suppress jump or trigger animations)\n- and are mutually exclusive but both can be true at once in this edge case\n- The struct documents as "Whether the entity hit a ceiling" - this semantic is violated\n\n## πŸ”Ž Evidence\n\n\nThe condition indicates the player is moving down (negative Y direction), yet is set in the else branch when (moving up or zero). This is backwards.\n\n\n## πŸ› οΈ Proposed Fix\nSwap the logic so that is set when (moving up into something):\n\n\n\nNote: should always execute regardless of collision direction (it's outside the if/else in the current code, but the structure should be clarified).\n\n## βœ… Acceptance Criteria\n- [ ] is only when the player was moving upward (positive Y velocity)\n- [ ] is only when the player was moving downward (negative Y velocity)\n- [ ] A falling player who lands on ground triggers , not \n- [ ] Unit tests verify correct flags for both upward and downward collisions\n\n## πŸ“š References\n- - struct documentation\n- - from \n- Issue #720 (related): "CollisionConfig.max_iterations is defined but never used in binary search"\n

Metadata

Metadata

Assignees

No one assigned

    Labels

    automated-auditIssues found by automated opencode audit scansbugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions