Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Andycb93
15
Years of Service
User Offline
Joined: 30th Dec 2010
Location:
Posted: 30th Dec 2010 20:06
I'm trying to make a pinball game but I'm having difficulty working out how to calculate how the ball should 'bounce' when it collides with an object.

I'm encountering problems when the object the ball's colliding with has sides which are at different angles (so an object would have vertical and horizontal sides and possibly diagonal ones as well). This isn't explained very well so have a look at the top of the picture I've attached.

To make it really clear the picture also shows what would happen if the vertical side of the object was hit and another showing what would happen if the sloped side was hit.

So I'm really wondering if there any is any way to work out the angle of the side the ball has hit and from there work out how the ball should bounce off.

P.S.
In my game I have hidden the white area surrounding the bumper so the ball sprite doesn't interact with it.
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 30th Dec 2010 21:52
Check out http://forum.thegamecreators.com/?m=forum_view&t=126064&b=5, it may have what you need.

Login to post a reply

Server time is: 2026-07-18 07:33:00
Your offset time is: 2026-07-18 07:33:00