I recently got a buttload of Killing Floor models and while the models work fine, their positions are not what they should be.
(not ironsights)
I have the default code for SWEP:GetViewModelPosition, but what can I add to it to shift the model’s position over to the right?
function SWEP:GetViewModelPosition( pos, ang )
if ( !self.IronSightsPos ) then return pos, ang end
local bIron = self.Weapon:GetNetworkedBool( "Ironsights" )
if ( bIron != self.bLastIron ) then
self.bLastIron = bIron
self.fIronTime = CurTime()
if ( bIron ) then
self.SwayScale = 1.0
self.BobScale = 1.0
else
self.SwayScale = 1.0
self.BobScale = 1.0
end
end
local fIronTime = self.fIronTime or 0
if ( !bIron && fIronTime < CurTime() - IRONSIGHT_TIME ) then
return pos, ang
end
local Mul = 1.0
if ( fIronTime > CurTime() - IRONSIGHT_TIME ) then
Mul = math.Clamp( (CurTime() - fIronTime) / IRONSIGHT_TIME, 0, 1 )
if (!bIron) then Mul = 1 - Mul end
end
local Offset = self.IronSightsPos
if ( self.IronSightsAng ) then
ang = ang * 1
ang:RotateAroundAxis( ang:Right(), self.IronSightsAng.x * Mul )
ang:RotateAroundAxis( ang:Up(), self.IronSightsAng.y * Mul )
ang:RotateAroundAxis( ang:Forward(), self.IronSightsAng.z * Mul )
end
local Right = ang:Right()
local Up = ang:Up()
local Forward = ang:Forward()
pos = pos + Offset.x * Right * Mul
pos = pos + Offset.y * Forward * Mul
pos = pos + Offset.z * Up * Mul
return pos, ang
end