Jump to content
  • Advertisement
Sign in to follow this  
Stone_Devil

mini putt collision detection

This topic is 4887 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

im trying to make a small little mini putt game in SDL....i have the collision on the walls working but only when the walls are horizontal and vertical....i was wondering if anyone could suggest a way to do the collision for walls at any angle thanks

Share this post


Link to post
Share on other sites
Advertisement
I assume this is in 2d? You might post your current code, as you might be able to adapt it to suit your needs. Collision between circles and axis-aligned lines can be extended pretty easily to include lines of arbitrary orientation.

Share this post


Link to post
Share on other sites
how exactly are you doing your collision detection? are you just testing every frame if the ball's gone behind the wall and stopping it or doing it the nice accurate way and calculating the time until the ball intercepts the wall edge and moving forward in time accordingly. if it is the latter, then two functions would be needed, one for returning the time, and another for performing the collision. anyway, please let me know so i can then provide the method :)

Share this post


Link to post
Share on other sites
right now i use a pixel perfect collision on the course....when the ball goes onto the transparent part of the course it checks which direction it moves and then finds the angle it needs to go and bounces off....so the course is splite into two images...the inbounds and the outbounds....i think theres probably a better way to do it....and yes it is a 2d game....

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!