I’m trying to make my own personal physical bullet and I don’t know how the spread works so I wanted to know what gmod originally does with the spread option of a bullet? I would also like to know what it does with the other options too but I don’t need too my the spread option is my only priority.
This is my code so for bullet creation that overrides Entity:FireBullet()
Meta.FireBullets = function( self, b ) --Meta is the Entity’s Meta Table
local rand = Vector(math.Rand( -b.Spread.x, b.Spread.x ), math.Rand( -b.Spread.y, b.Spread.y),math.Rand(-b.Spread.x + -b.Spread.y,b.Spread.x + b.Spread.y)/2) --this is the main part I dunno if it really replicates original gmod code with bullets local newdir = b.Dir + rand local Bullet = ents.Create( "phys_bull" ) Bullet:SetPos( b.Src + ( newdir * 50 ) ) --This depends on the rand arg so correct me if I'm wrong on this. Bullet:SetAngles( newdir:Angle( ) ) -- So is this Bullet.Dir = newdir --And this. Bullet.Force = b.Force Bullet.Damage = b.Damage Bullet.Callback = b.Callback Bullet.Owner = self Bullet:Spawn( )