O'Reilly logo

Torque 3D Game Development Cookbook by David Wyand

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adjusting the fire spread of a weapon

Some ranged weapons (those that fire a projectile) are more accurate than others. Of the weapons included in the Torque 3D templates, the pistol is very accurate while the assault rifle has some bullet trajectory drift. This is known as projectile spread. In this recipe we will learn how to set up projectile spread of a projectile weapon.

How to do it...

Start by making sure the ShapeBaseImageData Datablock instance of your projectile weapon has its class property set to WeaponImage. This gives the weapon access to Torque 3D's standard weapon handling methods.

The next step is to add the projectileSpread dynamic property to your weapon's Datablock instance and give it a value greater than zero to introduce ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required