Projectile collisions
by James Ford · in Torque Game Builder · 05/05/2007 (5:20 pm) · 4 replies
If I have two objects which both send and receive collisions and have collision callback enabled, and they collide, whos callback gets called? I would think both, but it doesnt seem to be that way.
And, in the callback who is SrcObj and who is DstObj?
All I want is a projectile that will collide with other objects, then I figured I could turn on send and receive collisions for all object-class-types, then in each class's oncollision i can define THAT classes reaction to the collision... So my projectile::oncollision removes the projectile from the scene and my Ooze::OnCollision removes/respawns the Ooze. (yes an Ooze) . The Ooze callback seems to be getting called by the projectile callback does not.
My guess is I have to make projectiles only send collisions and other objects only recieve collisions, then define what happens to both the projectile and ooze in the same callback, but why cant i break it up like I wanted to?
Then what if i want players to be able to collide with oozes (which i do), so they cant both only be receivers!
And, in the callback who is SrcObj and who is DstObj?
All I want is a projectile that will collide with other objects, then I figured I could turn on send and receive collisions for all object-class-types, then in each class's oncollision i can define THAT classes reaction to the collision... So my projectile::oncollision removes the projectile from the scene and my Ooze::OnCollision removes/respawns the Ooze. (yes an Ooze) . The Ooze callback seems to be getting called by the projectile callback does not.
My guess is I have to make projectiles only send collisions and other objects only recieve collisions, then define what happens to both the projectile and ooze in the same callback, but why cant i break it up like I wanted to?
Then what if i want players to be able to collide with oozes (which i do), so they cant both only be receivers!
About the author
http://jamesdev.info
#2
And in case you use collision groups and layers: are they set correctly on the script object as well?
Are the only two points I could think of as a reason for problems as my projectiles I create through script work. (although now with 1.5 I will most likely rewrite it to use template objects. Define with editor, instance with script or even behavior)
05/06/2007 (3:39 am)
Is the collision set up correctly? ie has it a collision polygon at all to collide?And in case you use collision groups and layers: are they set correctly on the script object as well?
Are the only two points I could think of as a reason for problems as my projectiles I create through script work. (although now with 1.5 I will most likely rewrite it to use template objects. Define with editor, instance with script or even behavior)
#3
Marc: Could you explain more how you would create projectiles in 1.5?
05/06/2007 (9:56 am)
The wierd thing is that the ninjastars ARE colliding with ninjas/oozes, as they are suppose to, because the ninja/ooze callbacks are getting called, but the ninjastar callback is not.Marc: Could you explain more how you would create projectiles in 1.5?
#4
This allows you to use them in other behaviors (the asteroid level from the behavior playground shows that when I remember correctly)
But its strange that it is called on one and not on the other.
Any chance you forgot to set the flag to tell it that it shall use the callback in your ninjastar creation code? :)
Just setting the callback function won't do that.
05/06/2007 (12:30 pm)
I would create them in the level editor and give them the template object behavior.This allows you to use them in other behaviors (the asteroid level from the behavior playground shows that when I remember correctly)
But its strange that it is called on one and not on the other.
Any chance you forgot to set the flag to tell it that it shall use the callback in your ninjastar creation code? :)
Just setting the callback function won't do that.
Associate James Ford
Sickhead Games
All of them send and recieve and callback for collisions
For some reason, ninjastar's callback is never getting called even though its set to true and I have defined a callback for the ninjastar class.
The only difference is how they are created: ninja / ooze are objects created in the leveleditor and ninjastar(s) are created and added to the scene in script. I've checked a ninjastar object once it is in the scene and its class, collisions, and callback all have the correct values, which were initialized by a ninjastarconfig datablock... Is there some reason why it wouldn't be "linked" to the callback function I've defined for the class?