05:355.21: Matter.js: Mouse Constraints - The Nature of Code
From the creator
In this video, I demonstrate how to use mouse constraints with matter.js to add mouse interaction to a p5.js physics simulation sketch. Code: https://thecodingtrain.com/tracks/the-nature-of-code-2/noc/6-physics-libraries/5-matterjs-mouse-constraints 🕹️ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/P8SECdBQ3 🎥 Previous: 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 to one more video about Matter.js! 1:07 MouseConstraints 2:13 Adding options 3:27 Attach mouse to the canvas 5:07 Add the mouseConstraint to the world 5:39 Issues with the PixelRatio 7:46 Draw something with mouseClicked() 8:58 Use the physics engine to figure out the location of the box 10:46 Adjust for the offset 11:52 Issues with using circles in a physics engine 13:00 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://thecodingtrain.com/discord 💖 Memb
Published 2017-03-09 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.





