which type of collision detection would you recommend?
Moderator: Coders of Rage
- cndr
- Chaos Rift Cool Newbie
- Posts: 65
- Joined: Sat Apr 24, 2010 7:03 am
- Programming Language of Choice: etc.
which type of collision detection would you recommend?
I am using SDL and have a circle on screen which I would like to use for a button. Which method of collision detection would be best for this scenario?
Long Live The Queen!
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Re: which type of collision detection would you recommend?
For circles, I usually use pythagorean theorem to find the distance from the click to the center. If it's less than the radius, its inside. Only for circles though.
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
- MrDeathNote
- ES Beta Backer
- Posts: 594
- Joined: Sun Oct 11, 2009 9:57 am
- Current Project: cocos2d-x project
- Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
- Programming Language of Choice: C/++
- Location: Belfast, Ireland
- Contact:
Re: which type of collision detection would you recommend?
Yea, this is pretty much the way to go for circles.ibly31 wrote:For circles, I usually use pythagorean theorem to find the distance from the click to the center. If it's less than the radius, its inside. Only for circles though.
http://www.youtube.com/user/MrDeathNote1988
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: which type of collision detection would you recommend?
This.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
- cndr
- Chaos Rift Cool Newbie
- Posts: 65
- Joined: Sat Apr 24, 2010 7:03 am
- Programming Language of Choice: etc.
Re: which type of collision detection would you recommend?
sorry for the delay, thanks for the help the Pythagorean theorem works great.
Long Live The Queen!