Monday, December 17, 2007

“Collision Detection & Bounce” is a very commonly implemented effect in games and the most accurate way to simulate this is by using trigonometry.

However, if you are just dealing with horizontal/vertical walls and regular shaped bounce objects [square/circle], there is an almost idiotic approach, it’s not accurate, but it gets the idea through.




The logic is very simple, if the ball were to hit the side walls, reverse its horizontal speed, if the ball were to hit the ceiling or floor, reverse its vertical speed. There, simple and idiot prove :D

No comments: