Keith Peters Looking forward to it. Sadly end of the weekend won't help me out for the assignment I'm trying to do but at least I'll finally understand this topic for the final exam.
Alternate bounce algo: if(x < 0) { oldx = -oldx; x = -x; } if(x > width) { var dw = width * 2; //this should be stored external to this function, but I put it here for simplicity oldx = dw - oldx; x = dw - x; } Explanation of the width * 2: The oldx will be n units from the edge, but you want to put it on the opposite side, so you calculate n as [width - oldx] and add that to width. width + (width - oldx) (width + width) - oldx (2 * width) - oldx The method in the video introduces latency (possibly simulating collision elasticity) when it sets the new x value to the edge instead of offsetting it.
When it's bouncing off the wall shouldn't you find the collision point and set the ball there? And then you should calculate the little other piece that it should've done instead of bouncing off. This seems simple but it's not precise
When bouncing the points off the right-hand wall, you set p.x to the room width. This doesn't account for it bouncing back into the room within the same frame, and makes p.y inaccurate. Should it not be `p.x = width - (p.x - width)` or more concisely `p.x = 2 × width - p.x`?
ruclips.net/video/3HjO_RGIjCU/видео.html Wouldn't be necessary to move the particle to make it lie on the dashed line? I mean, he moved it just on the horizontal axis to get it in the canvas again, but the particle would collide some pixels below that position, where the dashed line intersect with the canvas border.
Hey, Coding Math, I have a quick question. I am using an engine with the y values flipped. How would I flip them in the code? I've tried several ways and cannot get it to reverse. Thanks for the vid btw!
even after 6+years its the best explainations so far
This is the most useful tutorials of math for programming I've ever seen. Nice!
Agreed!
I cant belive you dont have more views, this is gold. Thanks for taking the time to make this vids!!
That "Say may name!"-part spoke out of my heart. 🙂
BTW: it's not "Runge-Kutta" with 'g' like in 'geography', but with 'g' like in 'go'. 🙂
Came here after Sebastian Lague's latest video. Worth it!
truly a verlet integration moment
This is by far the only good explanation of Verlet integration I've found in the last 2 days. It's a shame only one part is out so far. :(
I'm in the middle of working on Part II as I write this. Should finish it up by the end of the weekend.
Keith Peters Looking forward to it. Sadly end of the weekend won't help me out for the assignment I'm trying to do but at least I'll finally understand this topic for the final exam.
ULTRAsoulBRAWLER oh.... sorry, bad timing there.
Keith Peters No need to be sorry. I'm grateful this video exists so I can use it as a basis of knowledge for the subject.
Very good explained. Will watch the other videos! Did you inow your old blog was one of the reasons i got into programming like … 16 years ago 😮
Can't believe we're getting into numerical analysis, great video!
Alternate bounce algo:
if(x < 0) {
oldx = -oldx;
x = -x;
}
if(x > width) {
var dw = width * 2; //this should be stored external to this function, but I put it here for simplicity
oldx = dw - oldx;
x = dw - x;
}
Explanation of the width * 2:
The oldx will be n units from the edge, but you want to put it on the opposite side, so you calculate n as [width - oldx] and add that to width.
width + (width - oldx)
(width + width) - oldx
(2 * width) - oldx
The method in the video introduces latency (possibly simulating collision elasticity) when it sets the new x value to the edge instead of offsetting it.
Anyone tried doing spring cloth with euler integration ? the result is so hilarious, it just becomes a shaking ball and goes out of control
When it's bouncing off the wall shouldn't you find the collision point and set the ball there? And then you should calculate the little other piece that it should've done instead of bouncing off. This seems simple but it's not precise
you are so underrated!
I was trying to do something similar to the stick demo with the elastic physics, but I think that using the verlet integration will improve it a lot.
Yeah, you can do it with elasticity, but verlet lets you dial in the rigidity.
Oh, ok, that's useful
very nice did it in c++/SDL2 with this
WHEN ARE YOU GOING TO ADD A VIDEO ON ANGULAR CONSTRAINT LIKE THE LEGS ON THE EXAMPLE AT THE START OF THIS ONE
how do you get the ball to stop bouncing? because in theory its energy should become less every bounce but will never actually come to a true stop.
This is very useful, thank you. and very well explained.
I've been looking for this everywhere! Thank you!
Great explanation ! Instant 👍 Like!!
These videos are just awesome.
Sir can you please make one on RK Method of integration??
Super excited for the next part! Thanks!
This works fine as long as your frame rate is constant. Doubling the frame rate will double the point velocity...
Awesome video! Thank you!
Is there any way to simplify the modeling and management.. Like creating a module for making rects,circles,triangles etc?
When bouncing the points off the right-hand wall, you set p.x to the room width. This doesn't account for it bouncing back into the room within the same frame, and makes p.y inaccurate. Should it not be `p.x = width - (p.x - width)` or more concisely `p.x = 2 × width - p.x`?
Yes, not optimized for accuracy. More for simplicity and speed. Feel free to improve on it.
the correct formula is much more simple and consistent. you've claimed to teach people mathematics, after all :)
holy crap, I was soooo wrong :) Doing it my way makes it all so much more complicated further on.... Sorry, you were right ^_^
ruclips.net/video/3HjO_RGIjCU/видео.html
Wouldn't be necessary to move the particle to make it lie on the dashed line? I mean, he moved it just on the horizontal axis to get it in the canvas again, but the particle would collide some pixels below that position, where the dashed line intersect with the canvas border.
best vid ever it actually made me understand how this verlet integration works thanks man
2:23 doesn't really apply when you live in Germany (or Austria and Switzerland for that matter)🤷🏼♀️
Thanks for making these videos. Excellent brain candy!
thanks. brilliant video!
This is great. Thank you very much.
Hey, Coding Math, I have a quick question. I am using an engine with the y values flipped. How would I flip them in the code? I've tried several ways and cannot get it to reverse. Thanks for the vid btw!
+Setfenv I know this is obvious but have you tried using a -y instead of +y ?
Yes, I fixed it a long time ago. It was a lot easier than I than I thought XD
Very nice! Congrats!
The point seems to never actually stop, hmm
Thanks for the video! Isn't the simulation framerate dependent though?
You are my man!!
nice
Ha! You start off telling us how to pronounce "Euler", then at 3:47 you fail to pronounce "Runge-Kutta" properly!
:) I choose my battles. can't win them all.
Cooool!!!
Cool!!!
7:45 Line 28 & 29:
vx = p.x - p.oldx;