Rotated Boxes Collision Detection
Hi,
My question is about collision detection, to be more exact how to find out if two boxes that are rotated are overlapping.
I have searched the web and tried out several different CD libraries but none seem to be able to calculate this.
What I have is two objects (cars), I have their x,y location and their rotation. From this and some other code I can work out the x,y coords of the four corners. I then have 4 co-ordinates and wish to use these (the 4 corners of the car) to form the box.
How would I calculate whether these boxes are overlapping? At this stage I don''t really need pixel-perfect CD just to know whether these two boxes are overlapping.
My coords are usually something like this:-
.........x1,y1............x2,y2..........
.........................................
.........................................
................x3,y3.............x4,y4..
.........................................
The other box then might be rotated like this
.................x1,y1..........x2,y2....
.........................................
.............x3,y3..........x4,y4........
.........................................
.........................................
(I hope this looks right)
Could anybody point me in the direction of a set of functions that could do this?, any pseudo code would also be fine.
Thanks,
Oli Norwell
I remember seeing something about collision detection with rotated rectangles at http://qsoft.cjb.net/ (Have a look around in the tutorials section)
- Goblineye Entertainment
The road to success is always under construction
- Goblineye Entertainment
The road to success is always under construction
Goblineye EntertainmentThe road to success is always under construction
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement