Jump to content
  • Advertisement
Sign in to follow this  
selve

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

This topic is 2030 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
Advertisement

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  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!