Game Development Community

Collision Detection with projectiles

by Steven Sheffey · in Torque Game Builder · 09/02/2008 (10:00 pm) · 1 replies

Hey everyone. My problem is that Im using the DealsDamage behavior to shoot projectiles and within the behavior I have selected DeleteOnHit. Unfortunately when I shoot the projectile it actually collides with the shooter as soon as the user fires. I've gotten around this by offsetting the position at which the projectile spawns from the shooter but because I now want the shooter to shoot in all directions, this offsetting will still cause me problems and wont look to pretty as far as code is concerned. Anyway I guess Im wondering if there is a way to keep DeleteOnHit selected yet have it ignore the shooter collision altogether. I hope I explained the problem well enough. Thank you in advance.

#1
09/02/2008 (10:10 pm)
You'll need to use collision groups or collision layers.

For example: Set the group of the "shooter" to 1 and the "projectile" to 2. Then disable the shooter from colliding with group 2.