How to get consistent collision impulse values for colliding rigid bodies in Godot?
I'm writing a game where you can pick and throw objects and depending on the force of the impact they break.
Using the get_contact_impulse method to calculate the breaking point gives me very consistent results, but only for a single rigid body. When two rigid bodies collide, one of them reports the correct impulse, the other reports really low values, close to 0.
As an example, this is the same collision being reported by both objects:
SimpleCube_A2 collide with SimpleCube_A force 18.338762
SimpleCube_A collide with SimpleCube_A2 force 0.0180135
I believe this happens because once the second object runs its IntegratePhysics, the impact has already been solved by the first object (but this is just a guess).
I could just call a method on the second object, but since both objects will be reacting to the impact, I would have to add some bookkeeping to make sure the calls don't get recursive, nothing difficult but could be more error prone.
So I'm wondering if there's a solution where both objects can detect the "same" impulse, but without talking to each other. I don't mind having to calculate the impact myself or something like that, as long as it's reliable enough.