DEV Community

Zaky Abdurrahman
Zaky Abdurrahman

Posted on

1 1

Bullet Impact Simulation Using Phaser and Matter

Phaser JS is an open source JavaScript game framework for creating 2d HTML5 game. It is shipped with two physics engine: arcade and matter. While arcade is the one used in the official tutorial of phaser and relatively simple (collision, gravity, etc). Matter is a library of its own and can be used for more complex physics involving mass, density, force, friction, etc

Matter has its own documentation, but also has a documentation on Phaser API docs. So understanding how to use it on Phaser is quite challenging for me as for some things you can use the docs at phaser, but for other things, such as the body module, I need to read the matter docs instead. After some struggle, I managed to create a simple simulation of two bodies colliding with a collision detector. I hope it can be helpful for those who want to try making something in phaser using matter engine

Source code with demo link:
https://github.com/RussianMartabak/matter-impact

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay