|
-
Jun 6th, 2003, 04:06 PM
#1
Thread Starter
Addicted Member
Bouncing Ball
HEY EVERYBODY!
I'm trying to make a soccer 2D game for someone and there's a problem with the physics i'm trying to implement. (Too bad we don't learnt how to implement physics equations into code at school!) I wan't to make a ball that bounces like a normal ball in real life. So with friction, and gravity so that it doesn't keep bouncing for ever! I also want to make it so that when one of the players applies a force onto it, I want it to fly like a ball does when you head it! Any ideas? What equations must I use and how must I implement them? THANK YOU!
-
Jun 7th, 2003, 09:56 PM
#2
Fanatic Member
Here is all you need:
Acceleration of gravity: 9.8 m/s/s
All you need:
(m = metres, s = seconds, kg = kilogrammes (weight))
Distance - m
Speed - m/s
Acceleration - m/s/s
Time - s
Newtons (Force) m/s/s*kg
Friction = F (force that the object is being applied to the surface by (usually 9.8(gravity)*kg)) * X (amount of friction from the surface)
F*X, easy enough right? So if you have a 2 kg ball that starts 5m above the playing field, going 5m/s (no accel on horizontal) how fast will it be going after the first bounce?
X = on x axis, I = initial, F = final
D = 5
S(x) = 5
S(yi) = 0
S(Yf) = ? : -9.9
A(x) = 0
A(y) = -9.8
T = ? :: 1.01
F(yi) = -9.8 * 2 = -19.6
F(yf) = ?
Fric = -9.8 * 2 = -19.6
A few equations...
S(f)^2 = S(i)^2 + 2*A*D so to find the final Y speed:
X^2 = 0^2 + 2*-9.8*5=-98
sqr(x^2) = sqr(-98) = -9.9 (that'll give an error, do Sqr(98)*-1)
Now since speed is m/s and distance is m, you can isolate S for the time (you want the AVERAGE speed):
T = D / [ (S(i) + S(f) ) / 2 ]
X = 5 / [(0 + -9.9)/2] = -1.01 (obviously this won't be negative, so change it to 1.01)
Note that you don't really need the time here
So, the final speed is when the ball HITS the ground. Now assuming this ball defies a few laws... such as staying on the ground for more then .00000000000000001 seconds...
Answer = S(f) - 19.8
Now remember that friction can't let you put the speed below 0, so the answer is 0.
Note that: In most games gravity isn't as high as 9.8 and grass won't have a friction of 2.
That concludes your 5 minute physics class. Ask away.
Don't pay attention to this signature, it's contradictory.
-
Oct 13th, 2004, 06:37 PM
#3
Frenzied Member
Really basic physics, but a nice way of putting it - thanks!
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Hear me roar.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|