{"id":29673004,"url":"https://github.com/notchris/phaser3-planck","last_synced_at":"2025-07-22T21:09:33.430Z","repository":{"id":39123175,"uuid":"264100823","full_name":"notchris/phaser3-planck","owner":"notchris","description":"Implement planck.js physics in Phaser3","archived":false,"fork":false,"pushed_at":"2024-02-16T21:39:24.000Z","size":2420,"stargazers_count":24,"open_issues_count":21,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-07-19T22:22:56.327Z","etag":null,"topics":["phaser3","planck-js","plugin"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/notchris.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-15T05:05:53.000Z","updated_at":"2024-08-12T19:06:46.000Z","dependencies_parsed_at":"2023-02-05T11:46:07.787Z","dependency_job_id":null,"html_url":"https://github.com/notchris/phaser3-planck","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/notchris/phaser3-planck","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notchris%2Fphaser3-planck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notchris%2Fphaser3-planck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notchris%2Fphaser3-planck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notchris%2Fphaser3-planck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/notchris","download_url":"https://codeload.github.com/notchris/phaser3-planck/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notchris%2Fphaser3-planck/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266573245,"owners_count":23950187,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["phaser3","planck-js","plugin"],"created_at":"2025-07-22T21:09:32.819Z","updated_at":"2025-07-22T21:09:33.409Z","avatar_url":"https://github.com/notchris.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Phaser3 Planck Physics Plugin\n\n** The start of a TS version is here:  [phaser-planck-ts](https://github.com/notchris/phaser-planck-ts) **\n\nThis plugin integrates the [Planck.js](http://piqnt.com/planck.js/) (Based on [Box2d](http://box2d.org/documentation/)) physics engine with [Phaser3](https://phaser.io/phaser3), allowing for advanced collision detection and dynamic body types. This plugin is still in development, please feel free to submit a PR or issue to help us improve this integration.\n\n![](./example.gif)\n\n## Examples\n* [Github] (https://github.com/notchris/phaser3-planck)\n* [Online Sandbox](https://notchris.net/phaser3-planck/)\n* [Examples Source](https://github.com/notchris/phaser3-planck/tree/master/src/scenes)\n\n## Features\n* Support for Planck bodies (Box, Circle, Polygon, Edge)\n* Distance Joints, Revolute Joints, Conveyers\n* Sensors \u0026 Collision Filtering\n* Trajectory projection\n* ...and more!\n\n## Installation\n\nYou can install the latest version of **phaser3-planck** with your package manager.\n```\nnpm install -S phaser3-planck\n```\n\n## Usage\n### Setup\n\nFirst, import the package and update your global game configuration to include the plugin.\n\n```js\nimport PhaserPlanck from 'phaser3-planck'\n```\n```js\nconst  config = {\n\ttype:  Phaser.AUTO,\n    width: 640,\n    height: 480,\n    plugins: {\n        scene: [\n            { key: 'PhaserPlanck', plugin: PhaserPlanck, mapping: 'planck' }\n        ]\n    },\n    physics: {\n        planck: {\n            debug: false,\n            scaleFactor: 30,\n            gravity: {\n                x: 0,\n                y: 3\n            }\n        }\n    },\n\tscene: []\n};\n\nnew  Phaser.Game(config);\n```\n\n### Creating Bodies\n\nYou can create different bodies in your scene using the following syntax:\n```js\n// Box\nconst box = this.planck.add.sprite(0, 0, 'boxSprite')\nbox.setBody('box')\n\n// Circle\nconst circle = this.planck.add.sprite(0,0,'circleSprite')\n\n// Polygon\nconst polygon  = this.planck.add.sprite(0, 0, 'polygonSprite')\npolygon.setBody('polygon', {\n    points: [[0,64],[64, 64], [64, 0]]\n})\n\n// Edge (Line)\nconst edge = this.planck.add.sprite(0,0,'edgeSprite')\nedge.setBody('edge', {\n    x1: 100,\n    y1: 100,\n    x2: 300,\n    y2: 200\n})\n```\n\n### Configuring Bodies\nThe central Body class that all bodies extend, provides similar API methods / properties to Planck. A list of these properties / methods can be viewed below.\n\n**Important:**\nWhen using native Planck methods (on sprite.body), you must pass metric values. Sprite values are converted automatically from metric to screen coordinates within their preUpdate method. We include some convenience methods (listed below) that accept screen coordinates, which are then converted to metric. These methods can be used directly on the sprite class.\n___\n\n### Sprite methods\n\n##### .setPosition (x, y)\nUpdates the position of the sprite\n\n##### .getPosition ()\nReturns the position (in screen coordinates) of the sprite\n\n##### .setRotation (radians)\nUpdates the rotation of the sprite (accepts radians)\n\n##### .getRotation ()\nReturns the rotation (in radians) of the sprite\n\n##### .setStatic ()\nSets the current sprite body to static (will not be affected by gravity). Static bodies can still be transformed\n\n##### .setDynamic ()\nSets the current sprite body to dynamic (will be affected by gravity). Bodies are dynamic by default.\n\n##### .setSensor ()\nSets the current sprite body behavior to 'sensor'. Sensors will not collide with other bodies, but will still fire collision events\n\n##### .isSensor ()\nReturns true if the current body is a sensor\n\n___\n\n\n## Status\n#### Bodies\n| Type | Status |\n|--|--|\n| Box | ✔️ |\n| Circle | ✔️ |\n| Edge | ✔️ |\n| Polygon | ✔️ |\n\n#### Joints\n| Type | Status |\n|--|--|\n| Distance | ✔️ |\n| Friction |  |\n| Gear |  |\n| Motor |  |\n| Mouse |  |\n| Prismatic |  |\n| Pulley |  |\n| Revolute | ✔️ |\n| Rope |  |\n| Weld |  |\n| Wheel |  |\n\n#### Other\n| Type | Status |\n|--|--|\n| Sensors | ✔️ |\n| Conveyers | ✔️ |\n| One-way Platforms |  |\n\n\n## Contributing\nCreated by notchris \u0026 KingCosmic\nPlease feel free to post a PR / issue, we are looking for contributors to help with this effort. Thanks!\n\n*You are welcome to contact me on:*\n* Discord: **notchr.is**\n* IRC: **notchris**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotchris%2Fphaser3-planck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnotchris%2Fphaser3-planck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotchris%2Fphaser3-planck/lists"}