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.
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 ...