Crash in collision callback on deleting body

Vectrex

04-05-2008 06:55:38

Hi, in my collision callback I check the hit speed and tell the person to ragdoll themselves. I do this by adding up the contact speeds and in the processEnd I decide whether to ragdoll just the once.
Trouble is in the ragdoll code the body gets deleted and replaced by the ragdoll bodies (ogreNewt ragdoll). This causes the callback to crash. If I don't delete the original body it works.
Any ideas? It crashes inside newton itself

pra

04-05-2008 10:42:15

do you delete the body directly from the collision callback function?
you should delete it in the next frame, i.e. the next time the body's force callback is called