Rotating or flipping tiles in tiled doesn't work when using collisiondata and Matter physics
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: 3.86.0
Description
I am using Phaser with Matter physics. I use tiled to create tilemaps and add collision data/boxes in this software. When flipping or rotating the tile in Tiled, Phaser gives an error.
Example Test Code
const map = this.game.make.tilemap({
tileWidth: 16,
tileHeight: 16,
key: "MyMap"
});
map.addTilesetImage("tileset", "tileset", 16, 16);
const layer = map.createLayer(layer.name, ["tileset"]);
layer.setCollisionFromCollisionGroup();
this.matter.world.convertTilemapLayer(layer)
Additional Information
This code works fine when using a map without flipped tiles, it also works with flipped tiles that don't have collision data on them. But as soon you add a tile with collision data flipped (or rotated) it stops working.
A workaround is to add all tiles in each orientation in the tile editor, but I hope this issue can be solved in Phaser to keep tilesets smaller.
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 issue with the shown tilemap setup, including a rotated or flipped tile with collision data, then trace the map.createLayer, setCollisionFromCollisionGroup, and matter.world.convertTilemapLayer entry points. Done means flipped and rotated collision tiles convert without an error while unflipped collision tiles continue to work.
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
- Mostly clear
- Newbie friendliness
- 35/100