Bullet Spread

Something is fucked up with spread vectors and FireBullets.

Here’s what i have:

[lua]
function SWEP:ShootBullets( damage, numbullets, aimcone )

local scale = aimcone + ( self.Weapon:GetRecoil() / 3 )

local bullet = {}
bullet.Num 		= numbullets
bullet.Src 		= self.Owner:GetShootPos()
bullet.Dir 		= self.Owner:GetAimVector()		
bullet.Spread 	= Vector( 0, scale, 0 )		
bullet.Tracer	= 1
bullet.Force	= 20							
bullet.Damage	= damage
bullet.AmmoType = "Pistol"
bullet.TracerName 	= "Tracer" 
bullet.Callback = function ( attacker, tr, dmginfo )

end

self.Owner:FireBullets( bullet )
self.Weapon:ShootEffects()

end[/lua]

What i want to do is make my bullet only have spread on the vertical axis (so it only has spread upwards or downwards, not left or right). Setting the spread vector to Vector( 0, scale, 0 ) doesn’t seem to do anything. What should i do?

I’ve fucked around with every possible combination for the spread vector and nothing results in what i want. Am i missing something?

-snip-

[lua]
function SWEP:ShootBullets( damage, numbullets, aimcone )

local bullet = {}
bullet.Num 		= numbullets
bullet.Src 		= self.Owner:GetShootPos()
bullet.Dir 		= self.Owner:GetAimVector()		
bullet.Spread 	= Vector( aimcone , 0, 0 )		
bullet.Tracer	= 1
bullet.Force	= damage * 2 					
bullet.Damage	= damage
bullet.AmmoType = "Pistol"
bullet.TracerName 	= "bullet_tracer" 

end
[/lua]

This is how it was done it Jihad strike, so what you’ve got there should work :l

that vector gives you a horizontally fanning bullet with no vertical spread, which is the opposite of what i need.

[lua]Vector( up down , left right , diagonally/horizontally)[/lua]

[lua]Vector( scale, 0, 0 )[/lua]

You are wrong.

[lua]Vector(x, y, z (up))[/lua]

I use this in my SWEPS:

[lua]Vector(scale, scale, scale / 2)[/lua]

I tested it on [lua]LocalPlayer():SetEyeAngles(Vector)[/lua] Actually

Ahh they’re different nvm then!

This isn’t cartesian coordinates, it’s Pitch Yaw Roll.
/facepalm

Garry loves to use Vectors instead of Angles, apparently. /facepalm

Angles are basically just Vectors with some maths removed, a 3 value variable :stuck_out_tongue:

Vectors can stand in for angles quite well.

I don’t really understand the spread vector. To make a bullet spread in a cone shape, you use Vector( blah, blah, 0 ). So in theory removing one of the x/y variables should reduce the cone to an either flat/vertical spread. This isn’t the case for vertical spread though.

[editline]07:54PM[/editline]

If i really had to, i could hack in my own spread by just adding a random amount of spread to the player’s view angles. That’s messy and annoying though.