Game Development Community

Bullet penitration

by Jeff Wilkinson · in Torque Game Engine · 09/07/2003 (9:15 am) · 3 replies

I was playing crime force and I was fooling around with the weaponry on the firing rage and I saw that the sniper rifles went through more material and diffrent materials then other weapons and I am just wondering if there is a toutrial or can anyone tell me on how to program this into the torque engine?

#1
11/08/2003 (6:22 am)
Just seeing if anyone has a clue how to do this
#2
11/08/2003 (9:35 am)
You could add two variables to the projectile class to track penetration strength and current penetration When the projectile collides with an object increment the current penetration by the thickness of the object or just hardcoded value. If the current penetration value is higher than penetration strength then delete the projectile, otherwise let it continue. For really fast projectiles you might have take extra consideration, not sure.
#3
11/08/2003 (11:21 am)
I've worked with this.

First off, for projectiles, it's a good idea to castRay from start to end and then from end to start once you've begun to 'Penetrate' and object. This makes it so you and get the entry and exit points.

Second, from what I've seen, the Torque only has a few surfaces. So You'd have a lot of work ahead of you adding in things like wood, concrete, metal, rock, etc...

The whole hardcoded 'enertia' variable works fine, but since the projectile itself is set up so in the script all its actions point to the player. This makes hard to have it do anything special on certian surfaces unless you hardcode in a lot of special cases.

Another fine point to mention is the difference between hitting terrain and hitting an interior object. When you hit terrain, it only checks to see if you pass through the surface. If you hit an interior object, it checks to see if you're in open space or not. So if your projectile is passing through a wall of a building, it will return a hit for each step it takes through the wall, but will only return the times it passes through the surface for terrian. This fact increases your special cases.

If you really wanted to do this, what I'd suggest is that you make it so a projectile cannot penetrate terrain. In all actuallity this is a bit more realistic, because sand and dirt are really good at stopping bullets.