When a tilemap layer's fixedToCamera property is false, Arcade Physics works with offset tile maps, and everything looks okay as long as the camera isn't moved.
Support this in Arcade Slopes by passing through the tilemap layer to collision solvers.
A note on Phaser's tilemap layers:
Phaser's TilemapLayer implementation does thoroughly contradicts the fixedToCamera property with lines like these in its postUpdate() and _render* methods:
if (this.fixedToCamera)
{
this.position.x = (this.game.camera.view.x + this.cameraOffset.x) / this.game.camera.scale.x;
this.position.y = (this.game.camera.view.y + this.cameraOffset.y) / this.game.camera.scale.y;
}
this._scrollX = this.game.camera.view.x * this.scrollFactorX / this.scale.x;
this._scrollY = this.game.camera.view.y * this.scrollFactorY / this.scale.y;
So no matter where the TilemapLayer sprite is positioned, it will always scroll tiles with the camera. There is no way to override this without changing these methods.
This can be fixed by introducing a separation between the TilemapLayer's sprite position and its scrolling position, which will also help to fix mismatched collision as soon as the camera moves.
When a tilemap layer's
fixedToCameraproperty is false, Arcade Physics works with offset tile maps, and everything looks okay as long as the camera isn't moved.Support this in Arcade Slopes by passing through the tilemap layer to collision solvers.
A note on Phaser's tilemap layers:
Phaser's TilemapLayer implementation does thoroughly contradicts the
fixedToCameraproperty with lines like these in itspostUpdate()and_render*methods:So no matter where the TilemapLayer sprite is positioned, it will always scroll tiles with the camera. There is no way to override this without changing these methods.
This can be fixed by introducing a separation between the TilemapLayer's sprite position and its scrolling position, which will also help to fix mismatched collision as soon as the camera moves.