Sign in to follow this  

[C++/SDL] Rotated image & collision detection

This topic is 1756 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys,
I want to know how to rotate an image and make a collision with another object like this:
en1ce3lkgnez.png

First collision it's just an easiest collision without rotating any image. When the ball collides with the square, the XVEL of the ball changes to
-XVEL.
Now the question for you: how to make a rotated image and collision with the ball that changes the xVelocity and yVelocity depending on the rotated image position.
 

Share this post


Link to post
Share on other sites

SDL does not support image rotation on its own, so you'll need to either write the code yourself or use a library such as SDL_gfx. As for collision detection, the best way is probably using Verlet intergration. There's an article on it here.

Share this post


Link to post
Share on other sites
Sign in to follow this