Skip to content

hexus/phaser-sat-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phaser SAT Example

An example of using the Separating Axis Theorem for collision handling with Phaser.

Check it out for yourself here!

PhaserSat.js is a heavily commented Phaser scene that puts all of this together.

A screenshot of the Phaser SAT example in action

I put this together because I'm terrible at maths and wanted to learn how to perform collision detection and response against sloped tiles. I wanted something like this from a fantastic tutorial by Metanet.

Even though Phaser has its Ninja Physics engine, which is ported from the very examples linked above, I wanted to see if it could be done more concisely.

In the end was able to achieve this thanks to the awesome SAT.js library and this very handy tutorial.

Installation

Install NPM, install Bower, and then install the Bower dependencies.

npm install -g bower
bower install

Open up index.html in your browser!

Controls

WASD to move.

Releases

No releases published

Packages

No packages published