Game Development Community

Control object is some times lost when I die.

by Andy Hawkins · in Torque Game Engine · 04/11/2007 (4:15 pm) · 0 replies

Every now and then when I die, the camera shakes and doesn't run the death anim. Then it will crash. I've traced this to the control object being lost in the soucre code. Here's what I do to combat this but, it is still happening every now and. How can I force the camera to be th control object always - to avoid this when my player dies. Or is this something else?

if(isObject(%obj)){
      if (%obj.getState() $= "Dead")
         {
            
            if (%client)
            {
               %client.setControlObject(%client.camera);  // fix here ???
               %client.onDeath(%sourceObject, %sourceClient, %damageType, %location);
            }
         }