castCollisionList
by Gavin Beard · in Torque Game Builder · 02/23/2009 (1:33 am) · 4 replies
Hi all,
I'm having a play around we Behaviors at the moment and seem to be running into a wall with castCollisionList.
I have a callback setup for onCollision, which is being called without any problems, within the onCollision callback i', using %this.owner.castCollisionList(1); which always seems to return an empty list. I'm trying to get the object closest to object with the behavior attached at the time the onCollision is called, is ther eanything els ei need to enable other than making sure each object has the send and receive collision active?
Many thanks
I'm having a play around we Behaviors at the moment and seem to be running into a wall with castCollisionList.
I have a callback setup for onCollision, which is being called without any problems, within the onCollision callback i', using %this.owner.castCollisionList(1); which always seems to return an empty list. I'm trying to get the object closest to object with the behavior attached at the time the onCollision is called, is ther eanything els ei need to enable other than making sure each object has the send and receive collision active?
Many thanks
#2
02/23/2009 (1:20 pm)
Did you end up going with a "pick" function, a trigger or something else?
#3
02/23/2009 (1:48 pm)
I stuck with the castCollisionList, I am not sure what i did wrong the code, but re-writing it certainly, worked, the only difference was that on re-write i did an additional check to see what the results of a getWordCount were on the list returned from the castCollisionList, if it was 1 i just used the results without a getWord() performed on it, and if there was more than one item in the list then used the getword(). It may have made the difference :-)
#4
Im working on a tower defense game too and am running into the same problem and am trying to use castCollision too but it returns an empty list jus like u said....could u pls help me figure out how u did it?
10/07/2009 (12:48 am)
hey gavin,Im working on a tower defense game too and am running into the same problem and am trying to use castCollision too but it returns an empty list jus like u said....could u pls help me figure out how u did it?
Torque 3D Owner Gavin Beard
Byte Logic
Scrap this. I re-wrote all the behaviour code and now its super. It is for a basic Tower Defence prototype i decided to work on, now with the behaviour code each tower goes through a series of states (waiting, aiming, shooting, reloading) to handle its own, collisions, getting the nearest enemy object, aiming at it, then shooting, then reloads, then starts again. Its pretty good and I shall hopefully build upon it to create different behaviour for different types of towers
thanks all