Problems with path movement and deleting objects
by Ben Hickling · in Torque Game Builder · 08/03/2006 (11:28 am) · 5 replies
Hey everyone
I've been using path movement for my enemies, however, quite often when they get destroyed it will cause TGB to crash completely. I am using SafeDelete() to remove the objects, and I have even tried Removefromscene() which didn't seem to cause TGB to crash, but I don't think its supposed to be used like SafeDelete() (memory leaks, I think). Has anyone else enountered similar problems when using paths? Any help would be much appreciated! :)
Cheers,
-Ben
I've been using path movement for my enemies, however, quite often when they get destroyed it will cause TGB to crash completely. I am using SafeDelete() to remove the objects, and I have even tried Removefromscene() which didn't seem to cause TGB to crash, but I don't think its supposed to be used like SafeDelete() (memory leaks, I think). Has anyone else enountered similar problems when using paths? Any help would be much appreciated! :)
Cheers,
-Ben
#2
08/03/2006 (2:59 pm)
This is definitely a bug and has been fixed for the next release. For now, your best bet is to remove the object from the path before deleting it.
#3
08/03/2006 (3:01 pm)
I've tried telling the object to dismount from the path, I've even tried telling the path to clear all mounts, and even then it still crashes occasionally when the object is destroyed.
#4
08/03/2006 (3:16 pm)
That's really strange. As adam says, it's a bug but I had the same problem. I created a path and mounted an object to it. I then deleted the path and TGB would crash. I used the code I posted and from then on, TGB never crashed. Oh well, at least it's been fixed.
#5
08/03/2006 (4:08 pm)
Hmm, I just tried it again with the path.clear() function and it seems to be okay now. I must have been imagining things! Still, it's good to hear its being addressed for the next release. :)
Torque Owner Apurva Amin
function deletePlayerFromPath(){ $myPath.clear(); $myplayer.safeDelete(); }Should work.