"

We begin by calculating the velocity of the center of mass for the collision.

This value is determined by adding the velocities of the two colliding objects and then dividing by the total mass of the objects.

If the two colliding objects hit each other, this velocity is the velocity that the resulting composite object would have.

"

Here is an image.

Questions:

1. First of all, I don't understand what is the center of mass for the collision?

2. What is this combined velocity, and having sum of velocities over mass, is that some formula I should know?

This is the code for the collision:

private void BounceAsteroids(Sprite asteroid1, Sprite asteroid2) { { // both objects have mass 1, so we divide with 1 + 1 = 2 Vector2 cOfMass = (asteroid1.Velocity + asteroid2.Velocity) / 2; Vector2 normal1 = asteroid2.Center - asteroid1.Center; normal1.Normalize(); Vector2 normal2 = asteroid1.Center - asteroid2.Center; normal2.Normalize(); asteroid1.Velocity -= cOfMass; asteroid1.Velocity = Vector2.Reflect(asteroid1.Velocity, normal1); asteroid1.Velocity += cOfMass; asteroid2.Velocity -= cOfMass; asteroid2.Velocity = Vector2.Reflect(asteroid2.Velocity, normal2); asteroid2.Velocity += cOfMass; } }

I understand the code as a programmer, but I don't get the physics here. Why subtract cOfMass, then calculate the reflection vector and then again add cOfMass?

Thanks