Cheapest way to test an intersection
in
Programming Questions
•
2 years ago
Hi,
I have a main object, and multiple smaller objects scrolling across the screen. Every frame, the smaller objects check to see if they have collided with the main object.
My question is: Which is the the less expensive way to do this? Firstly, To use dist() to check the distance is less than the two objects radius combined. Or secondly, with a bounding box and check the usual way you would with a button, so: beyond and below top left corner, but above and before bottom left corner of a rectangle.
Or perhaps there is another better way that I have yet to think of?
As a side note i'd also very much like to know how I can work something like this out for myself without having to trouble you all, profiling? common sense?
Thanks in advance for your help.
Dave
1