Hello. i’ve got a question about force of impact between two bodies , in my case, bullet and crate.
what is the best method for get the impact power when two entities collide with angel script ?
i want to break some crate if the impact is high , else, nothing happen, just collide. i think there is a method with velocity and mass , but how ?
[SOLVED] Get force impact collision


In a physics collision event, the Contacts buffer contains collision contact information. Reading it is slightly non-obvious, but NinjaSnowWar demostrates it, see WorldCollision() function in GameObject.as . The impulse is read but not actually used in this game.

/// Physics collision ongoing.
URHO3D_EVENT(E_PHYSICSCOLLISION, PhysicsCollision)
{
URHO3D_PARAM(P_WORLD, World); // PhysicsWorld pointer
URHO3D_PARAM(P_NODEA, NodeA); // Node pointer
URHO3D_PARAM(P_NODEB, NodeB); // Node pointer
URHO3D_PARAM(P_BODYA, BodyA); // RigidBody pointer
URHO3D_PARAM(P_BODYB, BodyB); // RigidBody pointer
URHO3D_PARAM(P_TRIGGER, Trigger); // bool
URHO3D_PARAM(P_CONTACTS, Contacts); // Buffer containing position (Vector3), normal (Vector3), distance (float), impulse (float) for each contact
}
I think Contacts.impulse is what you need
how to get data from contacts you can see in example 18_CharacterDemo
EDIT:
while I wrote, you have already answered

Thank you very much !