Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (%i = 0; %i < %numProjectiles; %i++)
- {
- if (%this.projectileSpread)
- {
- // We'll need to "skew" this projectile a little bit. We start by
- // getting the straight ahead aiming point of the gun
- %vec = %obj.getMuzzleVector(%slot);
- // Then we'll create a spread matrix by randomly generating x, y, and z
- // points in a circle
- %matrix = "";
- for(%j = 0; %j < 3; %j++)
- %matrix = %matrix @ (getRandom() - 0.5) * 2 * 3.1415926 @ " ";
- %mat = MatrixCreateFromEuler(%matrix);
- // Which we'll use to alter the projectile's initial vector with
- %muzzleVector = MatrixMulVector(%mat, %vec);
- %muzzleVector = VectorScale(VectorNormalize(%muzzleVector),%this.projectileSpread);
- }
- else
- {
- // Weapon projectile doesn't have a spread factor so we fire it using
- // the straight ahead aiming point of the gun
- %muzzleVector = %obj.getMuzzleVector(%slot);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement