I imagine it's a lot like this, with just a few more and/or changed steps. :) Hard to wrap one's head around the whole thing, but... if one breaks it down, it becomes more doable in the individual pieces, and then once one has that, then one zooms out, and... it becomes easier. Not always easy, but easier. :)
As far as i am aware in 3D engines they use bounding capsules or just choice a " best" fitting shape to approximate the complex mesh...Just look at how it's done in games engines such as unreal and unity, there is no such thing as pixel perfect coilsion in 3d games, it would cost way too much resources and memory even on the fastest machines.
Very nice tutorial! Subbed, and this video shared with someone I mentor who's just getting into Processing (and/or p5). :) Looks like you have a bunch more, too... excellent!
Oh, one question, though: In the last section, what if mouseX and/or mouseY are between the two edges we check for? seems to me like we just don't set closeX or closeY in those cases?
@@DavidLindes I initialized closeX and closeY as mouseX and mouseY. So if at the very beginning, mouseX and mouseY are already inside the rectangle, then distance would be 0 and would be less than cr and the collision would be detected. So you still want to set closeX and closeY even in that case so that you can calculate the distance. Hope that answered your question!
@@pattvira Ahh, that totally makes sense! I missed the initialization, and I guess it probably wasn't still on the screen at whatever point I paused and looked. :)
So cool ! I can't even wrap my head around how they achieve 3D collision with differente meshes on those modern 3D engines. So cool.
I imagine it's a lot like this, with just a few more and/or changed steps. :)
Hard to wrap one's head around the whole thing, but... if one breaks it down, it becomes more doable in the individual pieces, and then once one has that, then one zooms out, and... it becomes easier. Not always easy, but easier. :)
As far as i am aware in 3D engines they use bounding capsules or just choice a " best" fitting shape to approximate the complex mesh...Just look at how it's done in games engines such as unreal and unity, there is no such thing as pixel perfect coilsion in 3d games, it would cost way too much resources and memory even on the fastest machines.
Free time here. You are doing an amazing job. Keep it up!
Thank you!!
I checked out your channel its super lovely what you are doing really hope the best for you. I am also a proud member of your news letter :>
i have a game where circle collides with blocks (rectangles) and need to change the direction of that ball after colliding. How to code it?
Amazing content! Keep it up! Thank you!
Thank you so much!
Nice and clean explanation.
Very nice tutorial! Subbed, and this video shared with someone I mentor who's just getting into Processing (and/or p5). :) Looks like you have a bunch more, too... excellent!
Oh, one question, though: In the last section, what if mouseX and/or mouseY are between the two edges we check for? seems to me like we just don't set closeX or closeY in those cases?
@@DavidLindes I initialized closeX and closeY as mouseX and mouseY. So if at the very beginning, mouseX and mouseY are already inside the rectangle, then distance would be 0 and would be less than cr and the collision would be detected. So you still want to set closeX and closeY even in that case so that you can calculate the distance. Hope that answered your question!
@@pattvira Ahh, that totally makes sense! I missed the initialization, and I guess it probably wasn't still on the screen at whatever point I paused and looked. :)
If i want to detect a collision between an array of circles and rects i need a nested for loop?
I have a tutorial that does just what you asked coming out Friday so be on the lookout for it! It’s a combination of OOP and nested loop.
@@pattvira Cool, ty
@@pattvira haha, awesome that you already have that in the queue. :)
nice!👍
Thank you so much 😊
Nice