Game Development Community

How do I make bullets bounce off walls?

by Andy Hawkins · in Torque Game Engine · 08/05/2008 (4:57 pm) · 6 replies

I want to allow the player to fire pinballs and have them bounce around the room slowly losing velocity. How can I do this please?

#1
08/05/2008 (5:12 pm)
Look at details for RigidShapes (like in TDN), make a ball and give it a certain amount of elasticty (so it will bounce with only partial momentum) and a low amount of friction (so it won't slow by travelling along the ground, unless you want it to)
#2
08/05/2008 (6:46 pm)
Projectiles already support this... if I recall correctly, while still in arming mode, the projectiles will bounce. In your ProjectileData datablock you'll need to set isBallistic to "true" then play around with bounceElasticity and bounceFriction. armingDelay controls... believe it or not... the arming delay. You'll need to dig into the engine code if you want bounce after projectiles are armed.
#3
08/05/2008 (7:12 pm)
Cool thanks for tip - this code worked...
armingDelay         = 5000;
   lifetime            = 5000;
   fadeDelay           = 5000;
   bounceElasticity    = 300;
   bounceFriction      = 0;
   isBallistic         = true;
   gravityMod = 0.80;
#4
08/05/2008 (7:15 pm)
I wasn't sure if you meant as weapons or as actual pinballs :P Kevin got it right then.
#5
08/05/2008 (7:26 pm)
Well now I can just make the projectile a ball yeah? I guess if I want it to be a real pinball I should us the rigidshape?
#6
08/05/2008 (11:43 pm)
The problem with Projectile is that it doesn't use a hull to collide - just its centre point. So if you're ball's going slowly, people will notice it going halfway into a wall before it bounces.