Arcade Physics: tilemap tile separation leaves body.position at sub-pixel values, causing 1px visual oscillation
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 40.3k
- Forks
- 7.2k
- PR merge metrics
- No merged PRs in 30d
Description
Version
- Phaser Version: Phaser 3.90.0
- Operating system: Windows 11
- Browser: Chrome
Description
When a sprite with Arcade physics collides with a tilemap layer, the tile separation code can leave body.position.y at fractional values (e.g., 63.9997 instead of 64). With pixelArt: true and integer tile sizes (16×16), this causes the sprite to visually oscillate 1px vertically each frame, it renders at Y=63 one frame and Y=64 the next.
The issue is specific to certain tile row boundaries and is reproducible regardless of room layout, gravity values, or body size. It affects both tilemap tile collision and separate static body collision when Phaser's separation algorithm is involved.
Example Test Code
https://jsbin.com/zoxusuyeve/edit?html,js,output
Additional Information
320×240 game, pixelArt: true, 16×16 tilemap, Arcade gravity {y: 800}
Sprite with body size ~12×14 standing on tiles at specific Y boundaries (e.g., row 4, pixelY=64)
Sprite visually vibrates 1px vertically while standing still
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior with the linked JSBin example using pixelArt, 16×16 tiles, and Arcade gravity. Trace the tilemap and static-body separation path to find where fractional body.position.y values remain. Done means sprites remain visually stable at tile boundaries, including the reported row-4 case, with regression coverage if the project has a relevant test entry point.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100