22:475.12: Collision Events in Box2D - The Nature of Code
From the creator
This video demonstrates how to listen for collisions and trigger events at the moment of collision in Box2D. Code: https://thecodingtrain.com/tracks/physics-libraries/physics-libraries/box2d/12-collision-events 🕹️ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/lIwDeySmP 🎥 Previous: https://youtu.be/bJJbQIoJeFc References: 🔗 Nature of Code: https://natureofcode.com 🔗 Nature of Code Processing Examples: https://github.com/nature-of-code/noc-examples-processing/tree/master/chp05_physicslibraries/box2d/NOC_5_5_MultiShapes 🔗 Box2D: https://box2d.org 🔗 JBox2d: https://github.com/jbox2d/jbox2d Timestamps: 0:00 Hi 1:33 Listening for collision events 2:39 Enable collision listening 6:00 Box2d will tell use which fixtures/bodies have collided 7:11 We need to know which particle is associated with the body 7:59 setUserData() and getUserData() 9:34 Look at the code example 10:14 Determine what kind of object has collided 12:10 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 💖 Membership: http://youtube.com/thecodingtrain/join 🛒 Store: https://standard.tv/codingtrain 🖋️ Twitter: https://twitter.com/thecodingtrain 📸 Instagram: https://www.instagram.com/
Published 2015-08-06 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.
Keep exploring Learn to Code
22:47
09:23Announcements across Microsoft SQL at Microsoft Ignite 2026 | Data Exposed
Microsoft Developer
05:34
02:05
02:17
10:51Competitive Programming Tutorial #42 | Convex hull trick: turn the DP into lines
SyntaxPilot
08:20