Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/physics/arcade/tilemap/ProcessTileSeparationX.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ var ProcessTileSeparationX = function (body, x)
}

body.position.x -= x;

// Float arithmetic can leave position at e.g. 63.9997, causing 1px
// jitter. Snap near-integer results but preserve intentionally
// fractional positions (non-integer body sizes from scaled sprites).
var rx = Math.round(body.position.x);

if (Math.abs(body.position.x - rx) < 0.01)
{
body.position.x = rx;
}

body.updateCenter();

if (body.bounce.x === 0)
Expand Down
11 changes: 11 additions & 0 deletions src/physics/arcade/tilemap/ProcessTileSeparationY.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ var ProcessTileSeparationY = function (body, y)
}

body.position.y -= y;

// Float arithmetic can leave position at e.g. 63.9997, causing 1px
// jitter. Snap near-integer results but preserve intentionally
// fractional positions (non-integer body sizes from scaled sprites).
var ry = Math.round(body.position.y);

if (Math.abs(body.position.y - ry) < 0.01)
{
body.position.y = ry;
}

body.updateCenter();

if (body.bounce.y === 0)
Expand Down