phaserjs / phaserjs/phaser

Arcade Physics: tilemap tile separation leaves body.position at sub-pixel values, causing 1px visual oscillation

Open
#7,252 0 comments 0 reactions 0 assignees View on GitHub

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

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.