# How to detect a collision and collision impact?

I would like to calculate "impact" of collision if its the right word for it. My scenario is: I have player, who is driving his vehicle. He then hits the wall while still in vehicle. I want to know if the collision happend and calculate the impact of collision, so later I know how much hp the player should lose depending how hard the hit was. I hope I made clear what I want to achieve.

What I'm currently doing is storing the previous vehicle speed and calculating the impact like this (previousSpeed - currentSpeed) / frameTime. It gives me some results but it's not consistent. Any other idea? It's in 3D so I have access to 3d vectors if it helps in any way.

• Check out this answer (4th post from the top).: forum.unity.com/threads/… – hatinacat2000 Nov 3 at 0:15
• Well it says to calculate the mass of the other colider aswell as the velocity of the other colider. In my case it's wall or anyother non-movable object, so it's velocity is 0 but I don't have mass of the object, and It would be propably stupid to make table of every object mass. – porqqq Nov 3 at 18:59

You are talking about momentum. It is represented by a vector, its value is $$\MLT^{-1}\$$ dimensionned. It is related to mass and speed this way: $$\\vec p=m\vec v\$$ where $$\\vec p\$$ and $$\\vec v\$$ are vectors. Momentum is conserved in isolated systems (no external force applied), which is the key point to make your calculations; you'll need to add some mass (eg., divide your objects (player) into smaller regions, each having a mass). Momentum is related to force as such: $$\\vec ft=\vec p\$$ where $$\t\$$ is time, $$\\vec f\$$ force vector.