How do i convert ApplyImpulseAtPosition to ApplyAngularImpulse & ApplyImpulse?

Does anyone know how ApplyImpulseAtPosition is converted to Angularvelocity and Velocity?

I have a lot of ApplyImpulseAtPosition calls and want to convert all of them into a single ApplyImpulse and ApplyAngularImpulse call to save performance on some really heavy calculations.

Wouldn’t using ApplyImpulseAtPosition directly be better than splitting it up into two functions?

Im not 100% sure, right now they’re used in a big loop which is called a lot of times.

I think if i combine the math and call impulse + angularimpulse once instead of calling ImpulseAtPosition 20 times in a loop, i can save a lot of performance.

I’m guessing you have to call impulseatlocation 20 times because there are 20 objects?

No there is 1 object, but the calculations have to be done on multiple points on the same object, which is why there could be 20 or more ImpulseAtPosition calls depending on the size.

If i can combine the 20 calls into a single angularimpulse and impulse call, i think it will save a lot of performance.

I know you’re talking about impulses, which are slightly different from forces, but here’s how you get the moment exerted upon an object from a force that’s offset from the center of mass:

pos_relative = center_of_forces - center_of_mass
torque = pos_relative:Cross(force_total)

The force itself will remain unchanged.
To convert those into impulses you multiply or divide them by the delta time, I don’t remember which one.