Question regarding CGRectIntersectsRect and rotated rectangular image
- by user309030
Hi guys,
I've got a long rectangular image which is rotated at different kind of angles. However the frame of the rectangular image does not rotate along with the image and instead, the rotation causes the frame to to become larger to fit the rotated image. So when I used CGRectIntersectsRect, the collision detection is totally off because the other image colliding with the rectangular image will collide before it even reaches the visible area of the rect image.
In case you don't really know what I'm talking about, have a look at the ascii drawing:
normal rectangular image frame, O - pixels, |, – - frame
|----------|
|OOOOOOOOOO|
|----------|
after rotation
|----------|
|O |
| O |
| O |
| O |
| O |
| O |
| O |
| O |
| O |
|----------|
I've read through some of the collision articles but all of them are talking about collision with a normal straight rectangle and what I really want is collision with a slanted image, preferably pixel collision detection. TIA for any suggestions made.