Game Development Community

SafeDelete crash TGB?

by Firas · in Torque Game Builder · 09/20/2006 (5:03 am) · 1 replies

When I call safeDelete in my oncollision function the TGB will crash, why this happen?

here is the code:

function playerClass::onCollision(%srcObject, %dstObject, %srcRef, %dstRef, %time, %normal,%contacts, %points)
{
    if(%dstObject.getName() $= "bump")
   {
     %dstObject.safeDelete();
   }
}

thanks in advance

#1
09/21/2006 (9:14 pm)
Have you tried the normal delete? SafeDelete, as I understand it, was written to allow objects to delete themselves (by basically holding off the deletion of the object untill the next frame so the interpreter is not currently referencing the object). I don't know why that would crash, and it obviously shouldn't, but try the normal delete function for now and post back with your results.