|
-
Jul 21st, 2010, 04:55 AM
#7
Re: Hit Testing a Rotated Rectangle
Can't you use polygon-point intersection? I've posted some code for that a few times before but I'm sure you can find it if you google something like "point in polygon". All it needs is the coordinates of the points that make up the polygon (4 points in your case) and the point you want to check for. It can return true or false depending on whether the point is inside the polygon or outside.
You would repeat this procedure 4 times, once for every corner of the 'player' rectangle. If you want the 'player' to be completely inside the polygon, then all four points must be inside the polygon. If, on the other hand, you are looking for intersection only, then you can return true if at least one point is inside the polygon.
I think this will be the easiest method and probably also the fastest.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|