Game Development Community

How to delete a object in the game?

by FanZhang · in Torque Game Engine Advanced · 05/17/2009 (2:25 am) · 4 replies

How to delete a object in the game which in the run time?I have a problem to delete a object which is a pathCamera that used delete() function at the game is running but when execute it the game craft!How can i fix it?Thnx:)

#1
05/17/2009 (5:33 am)
If I understand the queston correctly, I think %obj.delete in your function should do it.
#2
05/17/2009 (5:45 am)
ok,I have found the problem.Because when i delete the pathCam the function follow has not finished yet,so lead the problem:)
#3
05/17/2009 (10:02 am)
Just add an if statement.

"psuedo code"
function Delete()
 if %pathCam.!=done;
    %pathCam.done();
     %obj.delete();
else
     %obj.delete();

This is just to give an idea. There's probably much better ways to do this.
#4
02/07/2010 (10:15 am)
If I wanted to use a trigger for this event, would it be about the same concept?