I actually simulated all these physics in a program I made, including particles bouncing off each other. But I didn't use any Trig at all. I just did the basic math of accelerating the X and Y values appropriately. Knowing the trig makes these calculations so much simpler!
Here is a suggestion for a video: Collisions. For example cover elastic and inelastic collisions and how you'd simulate them in a program. Maybe create some particles and then have them crash together... like in pool. Thanks for the awesome videos!
Your wrapping version simulates a world that is 2*R larger in both directions than the canvas, a proper wrapping would be where the screen and the world is equal in size. So it looks better if you keep the comparisons on the cent of the circle, but you add more circles whenever the particle is closer than R to an edge, when close to a corner, this would mean drawing 4 circles in each corner of the screen.
8:10 Would the complicated math be to do the math of the next frame to get the collision before it happens (depending on Mass and Velocity squeeze the object for that collision frame, then continue the reflect/bounce code ?) But I guess this would double the math done on any colision detecting object unless it could be cached.
He said that the bouncing edge effect was not physically accurate. Is that just because in real life there is friction or did he just mean that the location of collision was causing issues (we are only approximating the collision point)? Reversing the x and y velocities when the ball hits its respective edge (assuming we calculate where the actual collision point is) similar to how he mentioned in the video simulates what would happen in a world without friction and where collisions are completely elastic right? Or is there something else that happens in real physics that I am unaware of?
Regarding the regen_extra.js,, does the iteration go like this: 1st - if pushes one particle 2nd - for loop renders the particle ... till the length is met in the if statement ? Is it hard to code a time frame between each particle ? Thanks for this great series!
yes, the if pushes one particle, but the for loop always renders all particles. so at first it's rendering just one, next time it renders 2, then 3 etc. you could move the if statement to a setInterval function, which would allow you to set the timing of when each particle is added.
Oh... as a quick mod to the bouncing ball in episode 3, I made it move side to side, flipped the bottom half of the sine wave, and fixed the edge handling without any of the fun particle stuff, almost identical to the bouncing ball in this video. Accidentally skipped 9 episodes, apparently. Oops!
I actually simulated all these physics in a program I made, including particles bouncing off each other. But I didn't use any Trig at all. I just did the basic math of accelerating the X and Y values appropriately. Knowing the trig makes these calculations so much simpler!
"Copy it into floppy disks and send it to TH-cam" that's funny haha
That joke at the end really got me off. :D
Here is a suggestion for a video: Collisions. For example cover elastic and inelastic collisions and how you'd simulate them in a program. Maybe create some particles and then have them crash together... like in pool. Thanks for the awesome videos!
Rob L I was going to suggest this as well. The collision detection videos are very good but a collision response video would be really really helpful.
Your wrapping version simulates a world that is 2*R larger in both directions than the canvas, a proper wrapping would be where the screen and the world is equal in size. So it looks better if you keep the comparisons on the cent of the circle, but you add more circles whenever the particle is closer than R to an edge, when close to a corner, this would mean drawing 4 circles in each corner of the screen.
alekmoth more complex. And "looks better" is subjective. It's an option though.
8:10 Would the complicated math be to do the math of the next frame to get the collision before it happens (depending on Mass and Velocity squeeze the object for that collision frame, then continue the reflect/bounce code ?) But I guess this would double the math done on any colision detecting object unless it could be cached.
He said that the bouncing edge effect was not physically accurate. Is that just because in real life there is friction or did he just mean that the location of collision was causing issues (we are only approximating the collision point)? Reversing the x and y velocities when the ball hits its respective edge (assuming we calculate where the actual collision point is) similar to how he mentioned in the video simulates what would happen in a world without friction and where collisions are completely elastic right? Or is there something else that happens in real physics that I am unaware of?
"copy it onto floppy disks and mail it up to youtube" lmao
Regarding the regen_extra.js,, does the iteration go like this:
1st - if pushes one particle
2nd - for loop renders the particle
... till the length is met in the if statement ?
Is it hard to code a time frame between each particle ?
Thanks for this great series!
yes, the if pushes one particle, but the for loop always renders all particles. so at first it's rendering just one, next time it renders 2, then 3 etc. you could move the if statement to a setInterval function, which would allow you to set the timing of when each particle is added.
Coding Math Thanks for the quick reply =)
Oh... as a quick mod to the bouncing ball in episode 3, I made it move side to side, flipped the bottom half of the sine wave, and fixed the edge handling without any of the fun particle stuff, almost identical to the bouncing ball in this video. Accidentally skipped 9 episodes, apparently. Oops!
it's impossible to follow what you do in this video