Path deletion error
by Samuel Marcus · in Torque Game Builder · 04/29/2007 (8:31 am) · 3 replies
(moved from general)
So I have an exciting issue with paths... basically I am spawning some helicopter objects- they move from the right side of the screen to the left, as helicopters are wont do. So to make their movement a bit more interesting I randomly attach them to paths, like so:
and then later...
(which flightplan they are being attached to is randomly decided earlier)
I will be the first to admit that I may not be doing this right-- especially given that once I do this, Torque inevitably crashes out with a fun mac system error (EXC_BAD_ACCESS) (note that console.log itself doesn't give an error).
Now, what triggers the crash is the deletion of the choppers, but those are just boring safeDeletes(). And when I tried just spawning choppers and giving them a MoveTo instead of a path to follow, they happily go on forever, no problems. So I feel it might have something to do with deleting objects that are on paths...
Ideas?
So I have an exciting issue with paths... basically I am spawning some helicopter objects- they move from the right side of the screen to the left, as helicopters are wont do. So to make their movement a bit more interesting I randomly attach them to paths, like so:
%this.flightplanC = new t2dPath()
{
scenegraph=$scene;
};
%this.flightplanC.addNode("600 -350");
%this.flightplanC.addNode("0 -250");
%this.flightplanC.addNode("-1000 -350");
%this.flightplanC.setPathType("LINEAR");and then later...
%this.flightplanC.attachObject(%chopper,100); %this.flightplanC.setOrient(%chopper,false);
(which flightplan they are being attached to is randomly decided earlier)
I will be the first to admit that I may not be doing this right-- especially given that once I do this, Torque inevitably crashes out with a fun mac system error (EXC_BAD_ACCESS) (note that console.log itself doesn't give an error).
Now, what triggers the crash is the deletion of the choppers, but those are just boring safeDeletes(). And when I tried just spawning choppers and giving them a MoveTo instead of a path to follow, they happily go on forever, no problems. So I feel it might have something to do with deleting objects that are on paths...
Ideas?
About the author
#2
06/11/2007 (7:51 pm)
I had exactly the same problem (even involving helicopters!). I can't find the thread right now, but someone suggested a work-around. When you're about to delete the chopper, first dismount it from the path, then schedule the safedelete() so that it happens in another function. You can schedule it 0 miliseconds later, it just has to leave the dismount function before starting the delete.
#3
06/11/2007 (8:07 pm)
Ooh ooh, were you making an Airborne! knockoff too?
Torque Owner Neo Binedell