## small help - body collision energy / damage

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

### small help - body collision energy / damage

I need some help regarding applying damage from collisions during material callback, when my cars collide - i process all the contacts to create special effects.

But after that is done, i'd like to calculate sort of damage to apply to both vehicles from their mass and velocity - and somehow divide that energy based on relative velocity into how much damage each car takes - basically, somehow divide collision energy based on velocity and mass of bodies.

I'm not totally sure if i even use proper terminology for this, but basically, when 2 cars going parallel touch at high speed, the relative collision energy is low, but if one object is slower and another crashes into it, the other body receives relaticely more energy than the first one.
Help improving the Newton Game Dynamics WIKI

JernejL

Posts: 1500
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

### Re: small help - body collision energy / damage

JernejL wrote:but if one object is slower and another crashes into it, the other body receives relaticely more energy than the first one.

I don't think so, it's only contactNormal.Dot(relativeVelocity) * massSum that matters?
Of course some car is more safe than another, and some regions of the chassis are more robust etc.

But if one guy holds an egg at rest, and the other smashes his egg against it, there's a 50/50 chance which egg breaks.

JoeJ

Posts: 1147
Joined: Tue Dec 21, 2010 6:18 pm

### Re: small help - body collision energy / damage

You mean NewtonMaterialGetContactNormalSpeed() ?

http://newtondynamics.com/wiki/index.ph ... ormalSpeed

"Calculate the speed of this contact along the normal vector of the contact."

I'm not sure what this actually means, but i've found one case on github, where this is directly used to calculate damage:

https://github.com/Alexei-Kornienko/Rac ... ar.cpp#L29

So i guess this is what i was looking for? this is the kinetic energy of the collision?
Help improving the Newton Game Dynamics WIKI

JernejL

Posts: 1500
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

### Re: small help - body collision energy / damage

JernejL wrote:You mean NewtonMaterialGetContactNormalSpeed() ?

Probably yes. But i'm confused wiki says the returned value is always positive. This would only be the case if the bodies are ordered accordingly, which i think is unlikely.

You could implement yourself if results are not as expected.

JoeJ

Posts: 1147
Joined: Tue Dec 21, 2010 6:18 pm

### Re: small help - body collision energy / damage

For a contact joints the value is positive, because the the negative friction force for contacts is zero.
Julio Jerez
Moderator

Posts: 11048
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles