Reputation: 7028
I have an airplane. I use rectangle
for bounding this airplane to detect collision and it works great. When the airplane begin falling down I rotate airplane's texture, but rectangle
remains unchanged. I don't know how to rotate it. I need to rotate it with airplane's texture because my shell doesn't collide the airplane's tail and cabine.
How to rotate rectangle or perhaps create polygon shape to wrap all airplane? Any help will be appreciated!
Upvotes: 1
Views: 1006
Reputation: 11
Use the polygon class to and draw your bounding Box.
Then within the polygon class there is a method to rotate.
Rotate and move the polygon with the plane.
Upvotes: 1
Reputation: 962
@jellyfication's answer points to raycasting, but a different and also simple approach you could implement is the Separating Axis Theorem. The links below will show you in detail what the algorithm is about and how to implement it. They also have some interactive demos so you get the 'feel' for what the algorithm is doing.
Good luck!
Upvotes: 2