p5.js Coding Tutorial | Collisions Without a Physics Library! @pattvira
p5.js Coding Tutorial | Collisions Without a Physics Library!  @pattvira
Uploaded August 2025 | Updated November 2026, 10 hours ago
LET'S CONNECT
✨ Sign up for my newsletter at pattvira.com
✨ Instagram: instagram.com/pattvira
✨ Twitter: twitter.com/pattvira
--
Links:
🔗 p5.js editor: editor.p5js.org
🔗 Collisions without a Physics Library Code: editor.p5js.org/pattvira/sketches/5kjsGcxd7
🔗 Introduction to Creative Coding Playlist: youtube.com/playlist?list=PL0beHPVMklwgMz4Z-mNp4_udo9mjBk7pn&si=XhvQaojd6cIrxvdn

Mentions:
🔗 Processing Foundation's Back-to-School fundraiser: donorbox.org/back-to-school-805292

References:
🔗 p5.js 2.0: beta.p5js.org
🔗 matter.js playlist: youtube.com/playlist?list=PL0beHPVMklwgaLt1xHqlKNvPZ7nKjHnH3
🔗 Quadtree: youtu.be/7pxyIC_ZEwA
🔗 @TheCodingTrain 's Coding Challenge 184: Collisions Without a Physics Library!: youtube.com/watch?v=dJNFPv9Mj-Y

Resources:
🔗 Dot product: youtube.com/watch?v=LyGKycYT2v0

Timestamps:
0:00 Intro
01:23 Approach
04:07 Use p5.js 2.0 and create a bouncing ball
08:08 Create a Ball class
17:17 Collide function - Step 1: Check if balls collide & Step 2: Correct their positions
24:08 Collide function - Step 3: Calculate new velocities
31:24 Create multiple Ball objects
34:39 Write a sleep method when ball is at rest (pushing effect)
38:27 Draw eyes and mouth and add colors!
46:18 Remove objects that are off the screen
50:50 Add some typography
57:22 Vary text weights for animation
p5.js Coding Tutorial | Collisions Without a Physics Library!First Year on Youtube & Whats Next!Sound Mini Series | EPISODE 1 - p5.Oscillatorp5.js Coding Tutorial | Image Manipulation - Pixelated Techniquesp5.js Coding Tutorial | Interactive Display with Rotating Blocksp5.js Coding Tutorial | Interactive Dandelion (with ml5.js - faceMesh)p5.js Coding Tutorial | Falling Sand - Lunar New Year Edition (with ml5.js)p5.js Coding Tutorial | Interactive Display with Rotating Blocks (UPGRADED)p5.js Coding Tutorial | Pendulum Waves 🎵p5.js Coding Tutorial | Binary Clockp5.js Coding Tutorial | Wiper Typographyp5.js Coding Tutorial | Generative Smiley Faces (Generative Art Series)
Patt Vira |

p5.js Coding Tutorial | Collisions Without a Physics Library!

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER