Skip to content

Latest commit

 

History

History
39 lines (22 loc) · 1.27 KB

File metadata and controls

39 lines (22 loc) · 1.27 KB

Rotate a Sword with Arcade Physics in Phaser 3 Example

A potential solution for Arcade Physics body that do not rotate with GameObject

License

Watch on YouTube

You can watch how this example was created here: https://www.youtube.com/watch?v=akgFNu60Kv4

Some code clean-up was added after the video ended that shows how it can work in both scenarios of having the circle physics body as part of the Container or as part of the Scene.

You can toggle the different cases in SwordContainer.ts by changing containPhysicsObject.

Motivation

This is a potential solution to a problem discussed on the Phaser Discourse: https://phaser.discourse.group/t/workaround-for-rotation-on-arcade-physics/5763/6

Demo: https://ourcade.github.io/phaser3-sword-rotation-arcade-physics/

Prerequisites

This example project uses the phaser3-parcel-template and requires Parcel.

Getting Started

npm install
npm run start

Running at http://localhost:8000

Assets

The sword graphic used in this example is by Kenney.nl.

License

MIT License