PhysicsEditor verticies wrong - MatterJS 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.22
- Operating system: Windows / Linux (tried on both)
- Browser: N/A
Description
Shapes created with PhysicsEditor are not parsed properly by Phaser. It has something
Example Test Code
https://codepen.io/nvitaterna/pen/RwNqqKN
Additional Information
PhysicsEditor exports the verticies in a 2D array. When this is flattened then re-wrapped (to satisfy Phaser's vertex sorting function) another array it gets the proper shape:
playerShipJson.playerShip3_blue.fixtures[0].vertices = [playerShipJson.playerShip3_blue.fixtures[0].vertices.reduce((a, b) => a.concat(b), [])];
I am new to using Matter.js but I believe I am following the docs properly in the way I have this set up.
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 with the linked CodePen reproduction and inspect how playerShipJson.playerShip3_blue.fixtures[0].vertices is passed to Matter.js. Compare the PhysicsEditor-exported 2D vertex array with the flattened and re-wrapped workaround described in the issue. Done means the exported shape is parsed correctly without that workaround.
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
- 25/100