# Rebound

This topic is 4647 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

As far as I know, when a purely elastic collision accours, the objects will exchange their momentum, and when a purely plastic (absorbtive) one accours, both objects will have the same momentum, which is the average of their original momentums. So I came up with this:

P1 = m1 * v1
P2 = m2 * v2

Av = (P1 + P2) / (m1 + m2) // Absorbtive velocity

Ev1 = P2 / m1              // Elastic velocity of object 1
Ev2 = P1 / m2              // Elastic velocity of object 2

new_v1 = e * Ev1 + (1 - e) * Av
new_v2 = e2 * Ev2 + (1 - e2) * Av


Now, that gives nice-looking results, but I want to make sure it is correct. I tend to misunderstand things often so I can't be too sure... ;) Can anyone please tell me if it is correct to calculate the rebound of two dynamic objects this way, and if it is not, what's the right way? (And why is my way wrong?)

##### Share on other sites
there's few things wrong: in code above,
Ev1=v1
Ev2=v2
(typo somewhere?)

Also, it is not good idea to have objects bounce with different elasticities(I suppose e1 and e2 is elasticities?). This way when colliding cotton ball with steel ball, steel ball will elastically bounce and cotton ball will not. Also momentum will not conserve.

In reality you have elasticity of collision that if you wish can be defined as average of elasticities. Or as product. (average seems to be better idea, at least it has proper dimensions). In reality everything is lot more complex and stiffness matters too (and wave propagation in the objects, by the way), but for games it generally doesn't matter.

(For example how stiffness matters, steel ball is as much elastic as rubber ball, but is much more stiff. In collision of steel ball with rubber ball, them bounce well. In collision of rubber ball and wood ball(wood ball has poor elasticity, but is stiff) them bounce well. But in collision of steel ball and wood ball(wood is less stiff than steel), bounce is poor.)

It should be done as
// reasonable approximation for elasticity of collision of two different things:elasticity=0.5*(elasticity_1+elasticity_2);// another more complex approximation, with general idea that elasticity of more stiff body matters less. Weighted average// elasticity=((elasticity_1/stiffness_1)+ (elasticity_2/stiffness_2))/(1/stiffness_1 + 1/stiffness_2)// find velocity of center of massVcm=(m1*V1+m2*V2)/(m1+m2);// find reflected(elastically bounced) velocities relatively to center of mass:// for collision with normal N useV1_reflect=V1 - Vcm - N*(2 * N dotproduct (V1-Vcm));V2_reflect=V2 - Vcm - N*(2 * N dotproduct (V2-Vcm));// ( for headon collision use//V1_reflect=Vcm - V1//V2_reflect=Vcm - V2// ) new_v1 = Vcm + elasticity*V1_reflect;new_v2 = Vcm + elasticity*V2_reflect;

(Note that momentum is conserved in above equations)

Velocity after elastic collision is given by Vcm + V1_reflect and velocity after inelastic collision is Vcm , so to blend between 'em one can just use Vcm + elasticity*V1_reflect

##### Share on other sites
Wait, the formula of the perfect reflection of a velocity is
Rv = v - 2 * dot_product(v, n) * n
Right?

So shouldn't it be something like:

e = (e1 + e2) / 2.0Av = (m1 * v1 + m2 * v2) / (m1 + m2)Rv1 = v1 - 2.0 * dot_product(v1, n) * nRv2 = v2 - 2.0 * dot_product(v2, n) * nnew_v1 = Rv1 * e + Av * (1.0 - e)new_v2 = Rv2 * e + Av * (1.0 - e)

[EDIT]

Never mind, I tested it and it's wrong...
I'm getting really tired with all this collision detection and response...

[Edited by - mrbig on October 24, 2005 4:51:06 AM]

##### Share on other sites
Quote:
 Original post by mrbigWait, the formula of the perfect reflection of a velocity is Rv = v - 2 * dot_product(v, n) * nRight?

only relatively to center of mass.
That's why i subtract Vcm from V1 and V2 in this formula
V1 - Vcm - N * (2 * N dotproduct (V1-Vcm))
, where V1 - Vcm is V1 relatively to center of mass.

(and of course N dotproduct (V1-Vcm) is same as dot_product(V1-Vcm , N))

My code must work, so you can just use it.

##### Share on other sites
Yes, your code probably works, but I don't get the "relatively to the center of mass" part and I don't like copy-pasting stuff I don't understand...
I know what a center of mass is, but I don't really understand what you mean.

[EDIT]

Wait a second, you thought I got rigid body dynamics in my engine?
Not yet.
All the bodies are "point bodies", so all particles have the velocity of the center of mass.

##### Share on other sites
No, I meant velocity relatively to the center of mass of system of two bodies(i.e. objects) together. The center of mass of system of two bodies moves with velocity Vcm (computed as in my code) or your Av. The velocity of center of mass of system is not changed by any interactions between parts of system (including collisions, elastic or inelastic), and that's why it is useful when dealing with collisions.

If you move with Vcm, from your point of view one object moves to the left and other to the right, and inelastic collision looks like two objects hitting eachother and stopping. Elastic collision looks like objects hitting eachother and then going back with velocities negated.

##### Share on other sites
"Elastic collision looks like objects hitting eachother and then going back with velocities negated."
Really? Then how do you explain it when a dynamic billiard ball hits a static one, and instead of "going back with it's velocity negated", the dynamic ball loses it's velocity and the static one gains it?

"inelastic collision looks like two objects hitting eachother and stopping."
If you'll throw an heavy sandbag on your sofa, it won't just stop, it will move backwards along with the sofa, not as fast as you threw it, of course, but it will.

However, what you said is correct for the kind collisions when an object hits something significantly more massive than itself.
Like a tennis ball jumping off the floor, or a sand bag, not jumping off the floor.

This is getting interesting...

##### Share on other sites
Don't put it out of context, i also said "If you move with Vcm, from your point of view one object moves to the left and other to the right" and it wasn't figure of speech. I also explained what Vcm means.

Let's for example we have ball A with m=1kg staying, and ball B with m=1kg moves with speed say 1 meter per second and hits B

Assuming collision is elastic.
Before:     v1=1m/s     v2=0  (A)-->        (B)               Vcm=0.5m/s , to the rightafter:                 v1=0m/s     v2=1m/s             (A)         (B)-->                      Vcm=0.5m/s , to the rightNow, looking from point of view of observer that himself moves to the right with velocity = Vcm = 0.5m/sbefore:             v1=0.5m/s       v2=0.5m/s            (A)->         <-(B) collision:                   (A)(B)after:              v1=0.5m/s       v2=0.5m/s          <-(A)             (B)->

You can make similar drawings for sandbag with m1=20kg and sofa with m2=10kg, for example. If sandbag moves with speed v1= 10 m/s and sofa stays we have Vcm=(m1*v1+m2*v2)/(m1+m2)
that is
Vcm=(20*10+0)/30 = 200/30 = 6.66...m/s
Then subtract it from velocities of objects to find their velocities as seen by observer moving with velocity Vcm .
edit: i was unable to find any sites discussing it in Russian, but there's link: http://www3.ltu.edu/~s_schneider/physlets/main/momenta4.shtml

(this center of mass view trick can be derived from energy and momentum conservation, but that's long and not very readable)

[Edited by - Dmytry on October 25, 2005 3:48:29 AM]

##### Share on other sites
Oooh!
Now I get it!
Relatively to the system's center of mass, both objects will have nagated velocities and will eventualy return to their original positions.
But since the center of mass is also moving with the system's evarage momentum, from the point of view of the observer, it would look like the first object stoped and the second one is moving.
That applet on the page of the link you gave me makes it so much clearer!
You know what they say, a picture is worth a thousand words. :D
Thanks!

1. 1
Rutin
19
2. 2
JoeJ
15
3. 3
4. 4
5. 5

• 23
• 20
• 13
• 13
• 17
• ### Forum Statistics

• Total Topics
631699
• Total Posts
3001775
×