[Math] Kinetic energy of impact between two moving objects

Hello.

I am having some trouble calculating the kinetic energy of an impact between two objects. The formula is simple:

I am confused as to how to convert this energy into a damage value when both objects are moving. If one object is stationary and the other is moving at 20 meters per second, the formula above gives
1/2mass20^2 = 200mass joules
but if we simply change the frame of reference we get new values for the kinetic energy. For example, if both objects are instead traveling at 10 meters per second towards each other, they’d each have a kinetic energy of
1/2
mass10^2 = 50mass joules
for a total of 100*mass joules when added together. I cannot wrap my head around why this happens. There shouldn’t be a difference in the impact between two cars crashing head-on while going at 50km/h each, and a stationary car being hit by another car moving at 100km/h. How can kinetic energy depend on the square of the velocity? How do I define 0 velocity?

Is there some better way of calculating the “damage” caused by an impact? This is obviously for a game, so I’m looking for plausibility, not 100% realism here.

You might try using (and be confusing) momentum instead of kinetic energy.

[icode]p = mv[/icode]

Mass m1 stationary, m2 moving at 20 m/s: (both are 1kg)

m1 * v1 + m2 * v2 = m1(0) + m2(20) = 20 Ns

Both moving at 10 m/s:

m1(10) + m2(10) = 20 Ns (the same)

Depending on what the calculations affect gameplay wise, I expect momentum might be better suited.
Momentum is what is used to calculate post-collision velocities as well, if that is what is you are solving for.

AP Physics was probably my favorite class in high school. :point:

I’m not sure. From a game balance perspective it might make more sense to use something that depends linearly on the velocity difference between the objects. However, from what I know the actual “damage” of an impact at a certain velocity should depend on the square of the velocity. Random Wikipedia quote:

[quote]By dropping weights from different heights into a block of clay, Willem’s Gravesande determined that their penetration depth was proportional to the square of their impact speed.
[/quote]
I also think I remember this as a motivation to why you shouldn’t speed when I got my drivers license. Raising the velocity just slightly is enough to go from 100% survival chance to 0% in the event of an accident. Now that I think about it, that should mean that the damage should depend on the velocity difference squared.

If you look at this from the point of view of one of the objects you are dealing with an accelerated frame of reference which behaves in a more complex way than a normal unaccelerated frame of reference. So I suggest you always use absolute velocities (i.e. velocities relativ to your game coordinate system).
Also after the collision the two objects might still be moving. You have to calculate the difference of the total energy before and after the collision.

This isn’t for collision response, it’s for calculating the damage caused by a collision. Also, why do things get more complicated if I look at it from the viewpoint of one of the objects?

Here is a more detailed explanation

In short, just don’t use an accelerated object as your reference.

The damage caused by a collision depends on the energy dissipated which is the kinetic energy befrore the collision minus the energy after the collision.

(I’m using my small knowledge of physics (because we haven’t been taught it properly at school yet), so I could be quite wrong)

It looks like you should be using force to calculate damage rather than energy.
In that case, it’s simply [icode]F = ma[/icode].

If we’re assuming instant deceleration of both objects, then [icode]a = velocity[/icode].
The resulting value is the force required to stop this object, which means it’s the amount of force put upon the other object in the collision.

So the damage multiplier for object1 would be [icode]object2.mass * (object1.speed + object2.speed)/2[/icode]
And the damage multiplier for object2 would be [icode]object1.mass * (object1.speed + object2.speed)/2[/icode]

If we’re not assuming instant deceleration, and that one object will push another if it is heavier, things get more complicated, and I don’t have the time to go into that at this point. If this is the scenario you’re looking for, maybe someone else could work it out or I could write more another time.

Edit: After thinking about this a bit more I’m not so sure if it does make a difference. Maybe the first situation works regardless?

Usually I use one of use math graph tools. make it so that it has a beginning, curve and end like the one I am expecting and than taking that formula… x)

Have you tried doing something like adding the velocities before you square them and taking the average of the masses?

Something like:

[quote]Ek = 1/2 (m1+m2)/2 (v1+v2)2
[/quote]
I don’t know if this will solve your problem, but I plugged a few numbers into it and got back desired results :slight_smile:

@Heroes: Wait, why would a = velocity?

If you can say that the collision resolved in 1 frame, then a would equal the velocity prior to collision divided by the time for 1 frame. To be more accurate you would have to subdivide each collision into more time slices than 1 per frame.

Assuming 60 FPS and a 1kg object moving at 1 m/s, which comes to a complete stop in 1 frame:

[icode]F = 1 * 1 * 60 = 60 N[/icode]

Another interesting method regarding impact damage that incorporates kinetic energy could be to find the change in energy over the collision.
With a couple examples, I’ll show why energy might not be desirable:

ΔE = 1/2m(vf2 - vi2)

To get the post-collision velocities (vf) you use momentum:

m1vi1 + m2vi2 = m1vf1 + m2vf2

In the two 1kg masses stopping each other at 10 m/s scenario:

10 + -10 = 0 + 0 Both vf’s are 0

Then, for each mass, the change in energy:
ΔE = 1/2(0 - 102) = -50 J (as expected, they each lost 50 joules)

For the stationary vs. 20 m/s: (still 1kg each)

0 + 20 = 10 + 10 (equal masses, equal momentum transfer)

ΔE1 = 1/2(102 - 0) = +50 J (stationary gained 50 joules)
ΔE2 = 1/2(102 - 202) = -150 J (moving one lost 150 joules)

That result may seem strange, but I’d say this is about right. It gets more interesting if the masses are unequal:

Let:
m1 = 1kg, 0 m/s
m2 = 3kg, 20 m/s

Assuming an elastic collision:
vf1 = (1 - 3)/(1 + 3) * 0 + 2 * 3/1 + 3 * 20 = 30 m/s
vf2 = (3 - 1)/(1 + 3) * 20 + 2 * 0/1 + 3 * 0 = 10 m/s

ΔE1 = 1/2(302 - 0) = +450 J
ΔE2 = 1/2 * 3(102 - 202) = -450 J

The two masses transferred the same amount of energy to/from each other, even though the small one was completely bowled over by a mass 3 times larger!
That would probably not make sense, gameplay wise.

I think force is probably a much better idea, although it’s more tricky because time is involved.
Remarkably similar talk on physics.stackexchange: http://physics.stackexchange.com/questions/18423/conservation-of-momentum-leading-to-damage

What an interesting problem, I never thought about that.
Half way down this article it explains your problem, see the “frame of reference” sub heading.

As it applies to your game, why not just always use the game landscape as the frame of reference to calc the damage which is a function of kinetic energy?

In a collision the difference in velocity doesn’t mean anything by itself. It’s all about momentum. Especially if you want to calculate damage.

TL;DR: I mainly wanted to calculate the kinetic energy to be able to relate and compare it to the explosive energy of the warhead of a missile for game balance purposes.

I’ve been Googling all day about this. I’m surprised by how little information I could find about this and my other related questions.

First let me take a step back and explain why I’m asking about this. I’m trying to figure out what would happen if two objects collide in space. The reason why I’m interested in kinetic energy is simply because many times space ships are going at extremely high speeds relative to each other, so kinetic projectiles will most likely be the main weapon of many ships. This includes both cannons firing unguided projectiles at extremely high speeds (Gauss cannons or rail guns) and missiles that contain a kinetic penetrator instead of a conventional or nuclear warhead. Example: https://www.youtube.com/watch?v=yHbf-Eb3xak&feature=youtu.be&t=41s My reasoning for kinetic missiles is simply that at some point, the amount of kinetic energy the missile has after accelerating towards the target be so high that the kinetic energy the missile has is higher than the energy released by its explosive warhead, at which point it would be better to optimize the missile as a penetrator and get rid of the explosive warhead altogether. This was the main reason I was interested in calculating the kinetic energy of a projectile; to be able to compare the difference in efficiency.

For small Gauss cannon projectiles, rail gun projectiles and kinetic missiles we can assume that the projectile will simply penetrate into the ship it hits and either exit the ship on the other side at a lower speed or come to a complete stop inside the ship. Therefore I need to figure out how much a projectile is slowed down by passing through X meters of a certain material. This would be a function of the width, mass and speed of the projectile and the density of the material being penetrated. I’ve reached the conclusion that there’s no real reason to go for a realistic approach here so just go with something that works well in the game. The only actual formula I’ve been able to find was this: http://en.wikipedia.org/wiki/Impact_depth which I think makes no sense since it claims that impact depth is not dependent on the speed of the projectile (it does however assume a “high” velocity).

However, things get an awful lot more complicated when the missile has a conventional warhead and is not made to penetrate the armor of the object it hits. In this case we can assume that the projectile will not significantly penetrate the object regardless of speed since the missile will essentially crumble and fragment into millions of pieces almost instantly, which significantly reduces the penetration depth. However, we still need to take the warhead’s explosion into consideration. This gets weird once you realize that the projectile may actually be traveling at a higher speed than the actual explosion of the projectile. To work around this, I’ve decided to only allow a certain type of warhead, namely shaped charges. A shaped charge is essentially a shotgun facing forward that fires a jet of metal particles when it’s triggered. This jet is also optimized to penetrate armor by applying as much energy as possible to a small area of the object hit, but the jet disperses quickly at longer distances. That should allow me to essentially use the same approach as for kinetic projectiles but with some quirks like the damage caused by the jet quickly falling off with distance and the fact that resulting speed of the jet is the speed of the missile when it hits plus the produces by the shaped charge’s detonation.

In the end this is more of a game balance problem than anything else, so I consider the problem solved for now. I’ll just have to experiment until I get it right I guess.

Yeah, not the most cut-and-dry problem. Hardcoded values for weapon properties is probably the most practical route.

That said I’m quite interested in what this project of yours is and how it contains all these things I know and love… :point:
I’ll stay tuned!

I’m trying to sort out the fundamental problems I have before posting much more, but I’ll eventually post about it here. ^^

Regarding the original question: when 2 objects collide, all that is important are the mass and the relative velocities. (obviously)

The question was: what is the reference frame, as this determines the relative velocity of each object.

The issue was that 2 objects traveling at +10m/s and -10m/s would yield different results than one moving at 0m/s and the other one at 20m/s. It is obvious that in reality, the damage to each object would be exactly the same in either situation, because the universe does not take into account our observer’s reference frame for Newtonian physics. (!)

When we want to determine the impact/damage to object A, we set the reference frame to A (making it stationary), and let B hit it.
When we want to determine the impact/damage to object B, we set the reference frame to B (making it stationary), and let A hit it.

Now we can safely say that both objects had the same impact (loss of kinetic energy) on eachother if their masses were equal, regardless of where the observer’s reference frame was.

Observer P may say that object A lost way more kinetic energy than object B gained, while observer Q may say the opposite, but object A and B couldn’t care less about P and Q. Therefore most calculations in this thread should be discarded, because they reason from such irrelevant observers. Setting the reference frame to ‘the game world’ would be such an arbitrary observer, leading all impact analysis to be plain wrong.

Unless you are travelling at relativistic speeds, a nuclear warhead will definitely deliver more energy to the target than any realistic impactor…

Physics results are will be the same no matter what frame of reference you use. So “cheat” and use the one that is the easiest. You can all sorts of math to prove that physics is the same in difference reference frames and that’s all fun. but if you don’t’ really care, just use the simplest frame of reference.

Sure, but people are trying to use kinetic energy to calculate impact/damage, and in that case the reference frame must be the object that was impacted.

Any calculation of an observer that is moving at a arbitrary velocity will vastly complicate the calculations, which, as this thread proves, easily results in plain wrong results. We’re all familiar with the conservation of energy, so if your calculations show that object A gains more energy from a collision that object B loses, it’s a red flag.

I wrote some code that collides two objects 100 times in different random reference frames and calculates the kinetic energy lost in the collision. As expected it gets the same result each time so it really is independant of the reference frame.

http://pastebin.com/dzvxs6RC