02-02-2007, 07:08 AM | #1 | ||
Join Date: Jan 2007
Location: Nunspeet, Netherlands
Posts: 31
|
Hello
I am trying to create a pinball game, but I don't know how to program a ball that bounces of the sides in a realistic way. Does anyone have any experience with this or already have some working code? Thanks in advance. |
||
|
|
05-02-2007, 06:20 PM | #2 | ||
Join Date: Aug 2005
Location: Ofverby, Finland
Posts: 12
|
It depends on the language you're coding in.
If you want to really make a realistic bounce, you should consider the following: - The tilt of the board - Friction - How much does the side absorb of the energy The easiest part is of the angle is probably the simple fact that when it bounces to the wall at an angle, it bounces off at the same angle. With the tilt applied etc. Physics are fun, aren't they? |
||
|
|
10-02-2007, 08:18 PM | #3 | ||
Join Date: Oct 2006
Location: Lisbon, Portugal
Posts: 15
|
If you don't know how to do it, why don't you create the table with Future Pinball (http://www.futurepinball.com/).
|
||
|
|
18-02-2007, 01:05 PM | #4 | ||
Join Date: Jan 2007
Location: Nunspeet, Netherlands
Posts: 31
|
<div class='quotetop'>QUOTE(Shadikka @ Feb 5 2007, 09:20 PM) [snapback]278143[/snapback]</div>
Quote:
<div class='quotetop'>QUOTE(orieac @ Feb 10 2007, 11:18 PM) [snapback]278761[/snapback]</div> Quote:
I will try to create something myself and If I make any progress I'll post it and maybe it can be of some help to someone else. Thanks anyway |
||
|
|
20-02-2007, 04:17 PM | #6 | ||
Join Date: Jan 2007
Location: Nunspeet, Netherlands
Posts: 31
|
Thanks for the link Reup. I will check it out.
I have written some code for a bounce on a straight wall. What I do is split the velocity in two part. The part parallel to the wall and the part perpendicular to the wall. Then I reverse the part perpendicular to the wall and I combine them to the true velocity. I know it's not perfect as this code generates a 100% perfect bounce. without any loss of energy, but for now it'll do. I can also use it for a bounce against an arc but the ball can get stuck for a while in some rare cases. Next up: adding gravity and friction |
||
|
|
13-03-2007, 05:19 AM | #7 | ||
Join Date: Sep 2005
Location: ,
Posts: 96
|
ever thought of trying out vectors? since a vector can describe an objects velocity and direction at any time it might make things easier
|
||
|
|
13-03-2007, 06:42 AM | #8 | ||
Join Date: Jan 2007
Location: Nunspeet, Netherlands
Posts: 31
|
Yes, I'm already using vectors, but thanks anyway.
|
||
|
|
14-03-2007, 02:17 PM | #9 | ||
Join Date: Oct 2005
Location: Tallahassee, United States
Posts: 167
|
And don't forget transfer of energy from the reflecting object. That is, if the bumper is pushing the ball i the opposite direction it may actually gain speed.
__________________
i kick spammers asses on every forum i register.beware! |
||
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Bouncing Babies | Tom Henrik | Games Discussion | 45 | 19-12-2009 10:30 PM |
Bouncing Bob Goes to Hell | chilledsanity | Cold Cases | 1 | 18-09-2007 09:00 PM |
On the Ball - World Cup Edition | Cadet Hog | On site | 4 | 23-05-2006 02:34 PM |
|
|
||
  |