A tutorial looking at the different ways Matter constraints work and how to take advantage of them.

Posted on 8th Aug 2019. Follow @phaser_ and get the Phaser World newsletter.


Emanuele Feronato has a new tutorial teaching you about how constraints work in Matter Physics: "I was wondering how to properly handle constraints in the Fling prototype when I probably came to a solution:

Basically a constraint is a rule which must be followed. In our case, the rule is “keep a certain distance between two bodies”. It seems quite an easy rule to follow, but what happens when the only way to keep the required distance causes two bodies to compenetrate?

Here we have a dilemma: keeping the distance and letting a body trespass another body or act as they were solid bodies – and actually they are – and break the constraint?

Look at this example: we have three static bodies at the top, three dynamic bodies at the bottom, three distance constraints with a little stiffness and a big static body in the middle of the screen.

What happens when we reduce the distance?"

Read More

Learn to code and lead your intrepid crew on a mission to save The Cloud in TwilioQuest, a PC role-playing game inspired by classics of the 16-bit era. Free forever, and available now for Windows, Mac, and Linux.

The first book on the creation of HTML5 cross platform games using Phaser 3 and other free software.
  • By Emanuele Feronato
  • 155 Pages
  • 28 Source Code Examples
  • Build a complete game from start to finish
  • Cross Platform
  • Scaling for devices
Buy Now