I work in Unity3D 5.3.4 on Windows 10.
There is a complex body consisting of several separate Rigidbody2D and CircleCollider2D , which are connected to each other via a SpringJoint2D . The task is to determine with what force the body hit the surface when it falls, so that when it hits more than a certain value, it reduces the strength and, if it drops to 0, start the object destruction procedure. What did for this. Added on each element an object fixing a collision:
void OnCollisionEnter2D(Collision2D collision) { float power = collision.relativeVelocity.magnitude; if (power >= dangerPower) { state.SetPower(power); } } at each step, the impact force in a collision is determined and the maximum value is stored in the state object for analysis.
Conducted tests with one Rigidbody2D+Collider2D (ball). When falling from one height, the value is constant. When I drop my body, the force of the blow there is different every time. I suspect that when the spring strikes from connected objects, they force the object to lose some of the energy and the speed after the impact due to this decreases.
If you complicate the tests and make a fall with the initial acceleration to the side and blows with a rebound from the side surface, then after falling on the floor, the value deviates even more and already even the ball has no stability in the obtained value.
In the ducks how is it stable to determine how much damage after a fall? Maybe someone has experience in solving such problems, or at least an idea how to make a calculation.