AI game generator · Collision response
Why Does My Player Get Caught on Wall Corners?
A detected collision still needs a movement response. Check what happens to the motion left after contact.
Keep valid sliding motion after contact
If a character stops when moving diagonally into a wall, inspect its collision response. A stop-on-hit method may discard the whole remaining move, including the part parallel to the wall. Use the engine's supported slide behavior when that matches your design, and inspect collider shape and contact normals. A closed corner can legitimately block both directions.
When an AI game generator produces sticky wall movement, save one repeatable approach angle before asking for a repair. Keep speed, controls and the level unchanged. A character that detects the wall and stops has a different problem from a fast character that passes entirely through a wall.
Separate detection from response
Godot's CharacterBody2D guide demonstrates this distinction. Its move_and_collide method stops a body when collision occurs; the developer supplies the response. Its move_and_slide method handles common sliding behavior. The guide explicitly describes an angled approach feeling like glue when no collision response is supplied.
Those are Godot method contracts, not universal setting names. Identify the actual engine and movement method first. Do not paste Godot instructions into an unrelated runtime, directly move the transform around its physics controller, or assume an option called continuous collision also chooses the response you want.
One contact, two very different endpoints
We ran an isolated Node calculation with supplied coordinates. A circular player has radius five and starts with its center at forty, forty. The solid wall begins at horizontal coordinate fifty and extends vertically beyond this move. The requested displacement is twelve units right and eight units up in our drawing. There is no gravity, friction, rotation or second obstacle in this first case. This is geometry and response arithmetic, not an engine or commercial generator test.
The center reaches the wall at horizontal coordinate forty-five because its radius already extends another five units. It takes five of the requested twelve horizontal units to get there. The fraction of the requested move completed is five twelfths. At contact the center is forty-five, forty-three and one third. About seven horizontal units and four and two thirds vertical units remain.
A stop-all response ends the move at the first contact. That is a valid policy for some objects, but it feels sticky when the intended action is sliding along a wall. In the slide calculation, we remove only the remaining component pointing into the wall and keep the parallel component. The center finishes at forty-five, forty-eight. No part of this result requires allowing the player through the wall.
Use a unit surface normal pointing into free space. For this wall it points left: minus one, zero. Take the dot product of the remaining motion and that normal. A negative result means the movement points into the surface. Subtract that inward component; keep movement that is already parallel or points away. Our calculation leaves a move of minus three, four unchanged, and turns a move of three, zero into zero, zero.
That distinction matters during a repair. Removing every normal component without checking its sign would also remove legitimate escape motion. A player should not feel attached to the wall after releasing the inward input. Log the normal and requested displacement rather than treating every contact as a reason to set both velocity components to zero.
A closed corner is a second constraint
Now add a second wall at vertical coordinate fifty, with solid space beyond it. The radius-five center cannot go above forty-five either. While sliding along the first wall, it reaches forty-five, forty-five and meets the second wall. The remaining upward displacement points into that second surface. Removing it leaves no allowed continuation in the requested direction. Stopping here is expected for this closed geometry.
Our first-wall endpoint of forty-five, forty-eight therefore applies only when there is no second wall on that path. It is not a promise that slide movement can escape every corner. The example assumes known flat surfaces and exact contact positions; it does not discover contacts, resolve starting penetration, or simulate a rounded corner. A real engine must handle those operations and its own tolerances.
Record three outcomes separately: stopped at the first wall despite available parallel space; slid until a second wall blocked the rest; moved away successfully when input reversed. Those observations distinguish a discarded remainder from a legitimate two-wall constraint. Keep a screenshot of visible collision shapes beside each log so a decorative tile edge is not mistaken for the actual obstacle.
Ask for a focused controller repair
Reproduce this diagonal wall contact without changing speed, controls or level art. Identify the engine, collider shape and movement method. Log requested motion, contact normal and remaining motion. If sliding is intended, use the engine-supported response and preserve valid parallel and away-from-wall movement. Check one flat wall, a closed corner and reverse input in the exported build. Explain any tolerance or collider change separately.
In Godot, inspect movement in the physics callback and distinguish a displacement passed to move_and_collide from the velocity property used by move_and_slide. Godot documents that move_and_slide can change velocity and process multiple contacts. Do not assume that changing the method name alone preserves your controller's units or existing state handling.
Questions before changing the collision shape
Should I replace the box collider with a circle?
A different shape changes clearance around corners. Inspect the debug shape first and test the actual controller. Our radius-five arithmetic explains one supplied case; it does not establish that circles fix every sticky corner.
Will a larger collision margin fix it?
Margins and recovery tolerances are engine-specific. Record the current value, isolate the failing contact, and compare the same approach after one change. A larger value can alter effective clearance; it cannot replace a missing response policy.
Is a wall seam the same as a closed corner?
No. A seam on an apparently flat route may expose tile collider boundaries or contact normals. A closed corner deliberately restricts two directions. Save the actual collision shapes and contacts before deciding which case you have. Use the one-bug repair guide and pre-publish checklist to retest the shared build.
Watch the collision-response explanation alongside this checklist.