How to do "phantom" collisions?
by Asura · in Torque Game Builder · 07/25/2011 (9:47 am) · 4 replies
Hi all,
Is it possible to do "phantom" collisions in Torque?
For example, say I have a ship in a 2D shooter, and enemy bullets being fired at it. I want to know, in script, when the ship and the bullets collide - but I don't want there to be any reaction to the collision onscreen (I want the bullets to pass through the ship, and the ship to pass through the bullets). All I want is for a callback to fire off.
Is there such a callback, or such a way to set up the collision system?
Is it possible to do "phantom" collisions in Torque?
For example, say I have a ship in a 2D shooter, and enemy bullets being fired at it. I want to know, in script, when the ship and the bullets collide - but I don't want there to be any reaction to the collision onscreen (I want the bullets to pass through the ship, and the ship to pass through the bullets). All I want is for a callback to fire off.
Is there such a callback, or such a way to set up the collision system?
About the author
#2
That is exactly what will happen. A callback will fire, but there will be no reaction if you don't provide one in the callback (such as delete or spin or whatever). You can do whatever you want in the callback.
One caveat though: you will get another callback for each frame that the objects are touching which is 30 callbacks per second if they are touching.
07/26/2011 (1:46 pm)
Quote: I don't want there to be any reaction to the collision onscreen (I want the bullets to pass through the ship, and the ship to pass through the bullets). All I want is for a callback to fire off.
That is exactly what will happen. A callback will fire, but there will be no reaction if you don't provide one in the callback (such as delete or spin or whatever). You can do whatever you want in the callback.
One caveat though: you will get another callback for each frame that the objects are touching which is 30 callbacks per second if they are touching.
#3
Charlie, I couldn't seem to do that - there seems to be no way in the editor to specify "none" when setting the collision reaction for objects in the editor.
Thanks for the advice both of you, in any case. I think triggers will work for what I'm trying to do just fine, at least for now.
07/26/2011 (11:48 pm)
I reworked what I was doing to use triggers instead, and it seems to work OK now.Charlie, I couldn't seem to do that - there seems to be no way in the editor to specify "none" when setting the collision reaction for objects in the editor.
Thanks for the advice both of you, in any case. I think triggers will work for what I'm trying to do just fine, at least for now.
#4
Hmm. I barely recall that I maybe had an issue with collisions "interacting" automatically. I believe the secret is to set the "Collision Response" to NOT "bounce" or "rigid" (or "kill"). In those cases, the physics engine get involved (or for "kill" the object is deleted). I have my stuff set to "CLAMP" but I think "STICKY" would be OK.
07/27/2011 (1:18 am)
Glad you got it working!Hmm. I barely recall that I maybe had an issue with collisions "interacting" automatically. I believe the secret is to set the "Collision Response" to NOT "bounce" or "rigid" (or "kill"). In those cases, the physics engine get involved (or for "kill" the object is deleted). I have my stuff set to "CLAMP" but I think "STICKY" would be OK.
Torque 3D Owner Matt Huston
Atomic Banzai Games