tubeshowcase●1,673,521 videos♡ My collection 0
← Learn to Code

Learn to Code11:26

5.19: Matter.js: Deleting Bodies - The Nature of Code

The Coding Train ↗

From the creator

This video is the third in a series on the matter.js physics engine. Here I look at how to delete off-screen bodies from the physics world, removing them from both my particle array as well as Matter.world. Code: https://thecodingtrain.com/tracks/the-nature-of-code-2/noc/6-physics-libraries/3-matterjs-deleting-bodies 🕹️ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/fbNLnk1Nn 🎥 Previous: https://youtu.be/uITcoKpbQq4?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM 🎥 Next: https://youtu.be/szztTszPp-8?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM 🎥 All: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM References: 🔗 Nature of Code: https://nature-of-code-2nd-edition.netlify.app/ 🔗 Matter.js: https://brm.io/matter-js/ Videos: 🚂 Matter.js playlist: https://www.youtube.com/watch?v=urR596FsU68&list=PLRqwX-V7Uu6bLh3T_4wtrmVHOrOEM1ig_ Timestamps: 0:00 Welcome back! 0:52 Add a new circle every frame 1:31 Remove a circle if it is offscreen 4:03 Discuss the flaw in the code 5:15 Loop through the array backwards 6:06 Removing bodies from the world 9:55 Remove the body from the world before calling slice() 11:08 Outro Editing by Mathieu Blanchette Animations by Jason Heglund Music from Epidemic Sound 🚂 Website: https://thecodingtrain.com/ 👾 Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide 🚩 Suggest Topics: https://github.com/CodingTrain/Suggestion-Box 💡 GitHub: https://github.com/CodingTrain 💬 Discord: https://thecodin

Published 2017-03-08 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code