Garry's Mod Wiki

WEAPON:GetTracerOrigin

  Vector WEAPON:GetTracerOrigin()

Description

Allows you to override where the tracer effect comes from. ( Visual bullets )

Returns

1 Vector
The new position to start tracer effect from

Example

Alternating muzzle flash position for dual wield gun, with view model and 3rd person view support.

function SWEP:GetTracerOrigin() local Owner = self:GetOwner() local ent = Owner:ShouldDrawLocalPlayer() and self or Owner:GetViewModel() if ( self.Tracer ) then self.Tracer = false local att = ent:GetAttachment( ent:LookupAttachment( "muzzle" ) ) or ent:GetAttachment( ent:LookupAttachment( "1" ) ) return att.Pos else self.Tracer = true local att = ent:GetAttachment( ent:LookupAttachment( "muzzle2" ) ) or ent:GetAttachment( ent:LookupAttachment( "2" ) ) return att.Pos end end