Chapter 28, Pixel-Perfect Collision Detection in 2D
Uploader Comments (groundh0g)
Top Comments
-
Really? Circles is simple. I thought you would have more complex shapes. Simple collision.
if(sqrt(((x1-x2)*(x1-x2))+((y1
-y2)*(y1-y2)))) <= diameter1 + diameter2){ return(true); }
All Comments (41)
-
@groundh0g If boundingCircle.Intersect(bound
ingCircle2)) collided = true; -
@groundh0g for(int i = 0; i < spheres.size(); i++) if( (cursor.pos-spheres[i].pos).le
ngth() < spheres[i].radius ) hit(i) -
@groundh0g you simply check the distance from the center of the circle to the centre of the other circle and see if its less than the radius of one plus the radius of the other. I'm not sure if that's what you've done, but that's all you've demonstrated. Circles are easy - if you want to demo your code, you need to use more abstract shapes.
-
@groundh0g hes talking about pythagorean theorum
-
@1dantheman100 agreed, pixel perfect hahaha, try doing it with an animated sprite as well, which frame do you have to check intersection on? static images are simplistic
-
can ny1 temme hw to appy...same collision for maze..im new to game programming...
-
did you use true pixel perfect detection or radial space? the video uses circles so it's difficult to know visually
-
@groundh0g The first thing you should know is the people who are commenting as such are probably not going to be your customer base as we already know how to code. Second, if your potential customers are coming here they probably don't want to see the author in a furry on his own videos.
Not that hard this is 1 line of code
0ChrisMackle0 7 months ago
@0ChrisMackle0 Really? Enlighten us. What would that one line be?
groundh0g 7 months ago 4
nice, but for a pixel perfect detection demonstration, one would think you would chose some model other then a circle:)
avion85 1 year ago 7
@avion85 Agreed. I'm not much of an artist, though. :)
groundh0g 7 months ago