Live Stream #82: Physics Engines and Matter.js

In this episode of The Coding Train, I provide an overview of physics engines. I a discuss a variety of libraries and the factors that go into picking an engine: 2D vs. 3D, collision detection, efficiency, etc.

I also take a look at the JavaScript physics engine Matter.js. I discuss you how to use this library for collisions in a p5.js sketch.

20:28 – Intro to Physics Engines
54:40 – Q&A on Physics Engines
1:10:13 – Intro to Matter.js
1:55:56 – Conclusion/short Q&A

Support this channel on Patreon:

Send me your questions and coding challenges!:

The Coding Train website:

Links discussed in this video:
Bullet Physics Library:
This Dot Song:
The Nature of Code:
My Nature of Code playlist on Physics Engines:
My Coding Challenge on 3D Cloth with toxiclibs:

Source Code for the all Video Lessons:


For an Introduction to Programming:
For my Nature of Code videos:
For More Live Streams:
For More Coding Challenges:

Help us caption & translate this video!






15 responses to “Live Stream #82: Physics Engines and Matter.js”

  1. haha Avatar

    I feel like I am in the classroom again. But I really enjoy these classes. Wish I were in NYU when studying my master degree.


    1:06:25 – After we talked about violating the rules of physics, your cup is invisible.

  3. Devon Farrier Avatar

    so dan… the longer you put something off (i.e. forEach) the harder it is to get to it

  4. kevnar Avatar

    I use plinko for a random distribution algorithm. If you want a random number in a certain range that favours numbers nearby, just start with that number and add a random -1 or 1 every iteration. The number of iterations is the range + or – the target number. So, if you want a number between 25 and 75 that favours 50, start with 50 and do 25 iterations of plinko.

  5. cheekoli Avatar

    what happened to the studio tour live stream from earlier today? I watched 2-3 minutes of it, but was busy at work, and had planned to watch it later.. bummer!

  6. Erik McCall Avatar

    yo I was wondering if you could update the vector stuff for p5.js? I am loving your stuff man!

  7. Erik McCall Avatar

    super love this channel!

  8. alchemist alchemist Avatar

    Hey Dan ! I think I found a great coding challenge on reddit, could you give a try at making this weird animation in p5 ?

  9. Jordan Simmons Avatar

    where can one procure that desktop background image

  10. Mees Broer Avatar

    weird EDITS in LIVE stream?

  11. Hitler Avatar

    Happy day of the liberation of Bulgaria
    Before 149 years my country was released form the Ottoman Empire thank to every single one of you and the RUSSIANS cuz they actullay helped us the most but all the credit goes to ALL of you not only the russians

  12. abraham linkan Avatar

    I am a student and currently learning programing.I still have to start java but your video make me want to learn java as fast possible. it looks so fun…love your videos,keep up the good work.

Leave a Reply

Your email address will not be published. Required fields are marked *