Sign in to follow this  
selve

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this