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 some spread. The Lurker weapon included with the Torque 3D templates is set up as follows:
datablock ShapeBaseImageData(LurkerWeaponImage) { // Add the WeaponImage namespace as a parent, WeaponImage // namespace provides some hooks into the inventory...