Simulating the "bounce"

D07934a90668e88866d5ac8b3529f686
0
Luminion 101 Jan 28, 2005 at 18:03

Hello,
First off I want to start my post off with my expression of praise of such a wonderful website you guys have here! I hope to remain here and evolve with the community. Now with that out of the way I’ll go on with my post.

I have a 3D app coded from scratch by myself using the OpenGL and SDL libraries. I already made a small math library with “complete” vector, matrices and quaternion classes all for learning purposes. Next I’ll make a camera class using a quaternion[and a matrix]. I’m glad to say that my camera works fine.

“Gee Jorge. What is your camera looking at?”
“Oh baby my new quaternion camera is looking at a sphere being brought down by Fg.”
“Gee Jorge what is Fg?”
“Oh baby it is the force of gravity, which is a vector, and it’s value is -9.81 s/m\^2.”
“Ooh baby your intelligence turns me on!!”

Eh…Let me get to the point. I have a red sphere, in this app, at rest at a high altitude. But its position will shift due to Fg[vector(0.0, -9.81, 0.0f)]. There is also a plane laying on y=0.0. When the sphere finally collides with the plane then the plane’s normal force should cancel out the force of gravity. Therefore the ball is at rest on the plane.

What I’m tyring to accomplish is realistic bouncing in one dimension. When the sphere hits the plane some of its momentum should be lost. According to one of Sir Newton’s laws momentum should be constant but only changes through force.

Some evidence

I guess some of that momentum is lost to energy or in exchange for[either one]. Well anyways while the sphere is at rest on the plane I need something to push it up because the normal force isn’t enough(it cancels out because the normal force + Fg produces a null or empty netForce).

What I did was add ( 0.0, (ball.velo.y*ball.mass)/-2.0, 0.0 ) to the netForce….which didn’t do anything. The division represents how much of it is lost. So in my case half of the momentum is lost. I divided it by negative two because I wanted the ball to go the opposite direction, away from the plane, which is up. And because Fg is there the ball should go back down creating “the bounce”.

Any suggestions?

4 Replies

Please log in or register to post a reply.

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jan 28, 2005 at 22:37

i was about to write a lengthy explanation but i’m way to tired to focus and frankly my physics english sucks. i’ll take some time tomorrow…

D07934a90668e88866d5ac8b3529f686
0
Luminion 101 Jan 29, 2005 at 01:51

@anubis

i was about to write a lengthy explanation but i’m way to tired to focus and frankly my physics english sucks. i’ll take some time tomorrow… [snapback]15510[/snapback]

Well I’m still looking forward to your lengthy reply despite the fact that I’ve resolved my own conflict with :

if( collided )
 velocity = -velocity * 0.8f;
 // -velocity * energy_lost

It works but doesn’t make any sense to me so I guess I’ll read up more on physics….

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jan 29, 2005 at 11:34

the general formula for a centered, elastic, collision looks like this :

vBall2 = ((mBall - m2) * vBall1 + 2 * m2 * v2) / (mBall + m2)

where mBall is the balls mass and vBall1 the velocity before the impact and m2 and v2 are the mass and velcoity of the plane repspectively. now you can add several asumptions like the mass of the ball being proportionally very small to the mass of the earth. also if you let the ball bounce on earth you can assume earths velcoity to be 0. of course imediatly after the impace gravitation will pull down the ball again.

additionally you can introduce friction of air with :

Fw = cw * (p / 2) A v\^2

where p is the density of air = 1,29 kg/m\^3
cw is 0,13 for spheres
and A = r\^2 pi
v is the balls velocity
the ball is then slowed down by
Fw = m * aw
aw = m * Fw m/s\^2

depending on the elasticity of the ball a lot of energy is converted into other forms. to actually find out how much energy that is is difficult because that would totally depend how the material of the sphere deforms on inpact. imo the best option is to introduce an elasticty factor that regulates this (as you did if i understand you correctly)

391445d5204cf56f9390e4cf6ed08634
0
marko 101 Oct 02, 2005 at 02:12

@Luminion

Well I’m still looking forward to your lengthy reply despite the fact that I’ve resolved my own conflict with :

if( collided )
 velocity = -velocity * 0.8f;
 // -velocity * energy_lost

It works but doesn’t make any sense to me so I guess I’ll read up more on physics….

if(sphere is near plane) {
vn = plane_normal `dot` velocity
if(vn < 0) velocity -= plane_normal * (1 + e) * vn
}

0 <= e <= 1,
1 - absolute elastic
Amount of energy lost is \~ (1-e)\^2