Game Development Community

Would it be possible? Some ideas

by Dustin Mullen · in General Discussion · 06/09/2008 (12:10 pm) · 3 replies

Is it possible to have a ricochet system in torque?

I thought about this for awhile.

Something along the lines of, if projectile hits an interior or a static shape then rotate projectile in a different direction. Then again, it could get a random direction and come back and hit you. I haven't thought out all the kinks in it, but maybe you guys can think of something also.

Another idea I tried was attributing the grenade resources to my projectiles. If you haven't seen it, it throws a grenade that bounces three times and then explodes. Maybe by attributing that to the bullets (with major changes) that could work as a ricochet system somewhat. The only problem is that the bullet would be told to explode and would not cause damage unless it exploded near the player. Also, it would be told to ricochet off the player if it hit the player instead of doing damage. Maybe one of the more advanced scripters can help us out with that.

If I ever get this right, I'll post up a resource on how to do it.

#1
06/10/2008 (1:29 pm)
Maybe implement something where you cast a ray from the gun muzzle to the target, and then use that ray to sample the kind of target you're hitting (in the same way that CoD has targets tagged for the kinds of materials they're made out of to see if the bullet penetrates). Once you know what kind of material, you can then implement a simple physics simulation like a pool ball hitting something and bouncing off for your ricochet. For each "bounce" you'll test for objects and see what they're made out of. The first object it tests for that is "shootable" gets damaged, ending the ricochet, or after a certain number of bounces, it would end.
#2
06/10/2008 (11:52 pm)
If you want to implement in the PHYSX physics engine, you can do that too

The cost is free and there are instructions on how to do it for TGEA (and possibly TGE)
#3
06/11/2008 (5:51 am)
@Nathan - The resource works for both engines: PhysX Resource by Shannon "ScarWars" Scarvaci

The resource itself is a simple merge, but you do have to pay attention since there have been changes made to Torque and the physics SDK since that resource was released.

I'd also keep any eye out for some pioneer GG community members working on a Havok integration.