Hi, I'm new on Irrlicht, I read all the tutorials and examples, but I don't know how to check that images are collision.
I know only how to use draw2DImage() and how to use event to control image movement.
I want to know it because I use this function to create GUI and I use this function to change my cursor icon(hide default icon before) so I want to check that images are collision.
How to do 2D Image collision detection
-
- Posts: 62
- Joined: Fri Aug 22, 2008 7:22 am
2d = rect = normal rect collision?
a rect has an x,y coordinate and a width,height of the rect.
to check if 2 rects collide in any way:
you just check if one corner of rect1 is inside of rect2
a rect has an x,y coordinate and a width,height of the rect.
to check if 2 rects collide in any way:
Code: Select all
if( rect1.x >= rect2.x && rect1.x <= rect2.x + rect2.width
&& rect1.y >= rect2.y && rect2.y <= rect2.y + rect2.height )