AI game generator · Collision diagnosis

Why Does My Fast Player Pass Through Walls?

A collision check can miss the space between two positions. Inspect the movement path before changing the wall art.

Check the whole movement, not just the endpoint

A fast character can cross a thin wall between collision checks. Log its old and new collider bounds, then use your engine's supported continuous collision or shape-sweep approach when appropriate. Check collision layers and movement APIs first: an invisible collider or a bypassed physics update can produce a similar symptom.

If an AI game generator creates a character that collides at walking speed but crosses walls during a dash, preserve that exact dash as the repair case. Do not ask it to replace movement, combat and level design together.

Rule out a missing collision relationship

Show the actual collision shapes in your engine's debug view. Confirm that the player and wall have compatible collision layers or masks, and inspect whether movement uses a physics-aware method or directly changes position. A correctly drawn wall sprite does not prove a collider exists. If slow movement also crosses the wall, inspect those basics before diagnosing tunneling.

MDN's 2D collision guide explains bounding-box overlap checks. They describe whether shapes overlap at an inspected position. They do not, by themselves, inspect every position travelled between updates.

Two clear endpoints can hide one wall crossing

We ran a small Node interval model to isolate the geometry. The player is eight units wide, and the fixed wall occupies horizontal coordinates fifty through fifty-four. They share vertical space throughout the move. These are supplied coordinates, not a measured frame rate, engine recording or commercial generator test.

In the fast rightward case, the player's left edge moves from zero to one hundred in one step. At the start its interval is zero through eight. At the end it is one hundred through one hundred eight. Neither position overlaps the wall, so an endpoint-only test returns false even though the move crosses the wall's entire width.

Synthetic horizontal move: an eight-unit player moves from left edge 0 to 100 past a wall at 50 to 54; first contact occurs at left edge 42.
A horizontal fixed-wall example; the rectangle's width matters when finding first contact.

The first contact occurs when the player's right edge reaches fifty. Its left edge is therefore forty-two, not fifty. The contact fraction of the proposed move is forty-two divided by one hundred: 0.42. Stopping the player's left edge at fifty instead would place eight units of the player inside or beyond the wall, depending on its width.

Left-edge moveFinal overlap?First contact
0 → 100NoLeft edge 42; fraction 0.42
40 → 45YesLeft edge 42; fraction 0.40
100 → 0NoLeft edge 54; fraction 0.46
0 → 20NoNo crossing
100 → 120NoMoving away; no crossing

The reverse case checks another frequent mistake. Moving left from one hundred toward zero reaches the wall's right face at fifty-four. Reusing the rightward forty-two calculation would put the character on the wrong side. A repair should preserve movement direction and inspect the appropriate leading edge rather than hard-code a single stopping coordinate.

Turn the symptom into a repair ledger

Record the previous collider bounds, proposed bounds, movement duration or step identifier, and the first wall hit if your engine exposes it. Add a slow approach, the failing dash, a reverse approach and a move away from the wall. Keep the collider sizes and wall unchanged while comparing outcomes. Our five model cases cover those distinctions; they do not establish that an actual engine implements them correctly.

For a custom horizontal prototype, the core calculation is small. When moving right from entirely before this fixed wall, ask whether the old right edge was at or before its left face and the proposed right edge reaches or crosses that face. If so, the candidate contact position is wallLeft minus playerWidth. A real two-dimensional solver must also handle the vertical interval over the move, multiple obstacles, initial penetration and collision response.

A point ray through the character's center is not automatically equivalent to sweeping its full shape. A wide character can catch a corner while its center misses it. Prefer the engine's shape-aware movement or collision query when available, and verify what the query includes. Detecting a contact also does not prescribe whether the character stops, slides, bounces or triggers damage; state the desired response explicitly.

Smaller simulation steps can reduce displacement between checks, but do not treat an arbitrary higher display frame rate as a universal fix. The rendering rate and physics step can differ, and smaller geometry can still be skipped. Measure the failing move and use the engine's supported solver rather than changing unrelated visual settings.

Our assertions checked the two missed endpoint crossings, the short move that ends overlapping, and two moves that never reach the wall. Boundary touching is treated as contact, while the overlap test requires penetration. This distinction is deliberate and explains why contact and overlap are not interchangeable. Replay equivalent cases in the exported playable build before marking its collision defect fixed.

Ask for an engine-specific change

Box2D's simulation documentation describes tunneling and sweeping shapes to find a time of impact. Its continuous-collision and bullet rules have specific body-type limits. That documentation is an example of an engine contract, not a claim that your AI-generated game uses Box2D or has the same setting names.

Keep the current controls, speed and wall layout. Reproduce the dash-through-wall case. Show the collider bounds before and after the move, identify the physics engine and movement API, then use its supported collision-aware movement or continuous-collision option where applicable. Preserve the intended stop or slide response. Compare slow, fast, reverse and away-from-wall cases on the actual build.

Questions before publishing

Should I just make the wall thicker?

A thicker collider may hide a particular miss while changing the level's geometry. Keep that as a deliberate design change, and verify the original movement defect separately.

Why does it happen only after Restart?

Check duplicated update loops after Restart before changing the collision solver. Extra updates can change movement behavior; that is a different fault.

Is this the same as floaty controls?

No. Input-release distance concerns how the character slows down. This guide concerns crossing an obstacle between inspected positions. Use the one-bug repair guide to keep the request focused.

Watch the illustrated movement-path explanation alongside this checklist.