Gmod4ever posted:
Player:GetShootPos() returns the muzzle bone of the gun. I'd think.
Except that it doesn't :)
In my SWEP think function:
self.Flashlight:SetPos(self.Owner:GetShootPos())
That always puts the flashlight model right on my head.
Edit:
The location of the muzzle is:
self.Weapon:GetAttachment(self.Weapon:LookupAttachment("muzzle")).Pos
(May not work for CS weapons, as they have a different attachment name or something)
Edit: Except that's the location of the world model's muzzle, not the view model's. Even doing
self.Owner:GetViewModel():GetAttachment(self.Owner:GetViewModel():LookupAttachment("muzzle")).Posdoesn't seem to work quite right for the view model's position.