2 Questions about modeling

Hi,

So I have recently gotten into making entity models, and basic swp models (A key, etc) I was wondering, as my first question, how do I make an animation when someone fires (or uses) their weapon?

My second question is how do I port FPSBanana models to gmod. I have it sorta working but the model (on ttt) is stuck in the waist and I used the code below, but the weapon will lagand glitch into the person when walking.

Could anyone answer one or both of these questions?

Thanks :slight_smile:

P.S I know its possible to port models to gmod since it was done with m9k.

Code:


SWEP.Pos = nil
SWEP.Ang = nil

SWEP.Offset = {
Pos = {
Up = 0,
Right = 1,
Forward = 3,
},
Ang = {
Up = 0,
Right = 0,
Forward = 0,
}
}

function SWEP:CalcAbsolutePosition(pos, ang)
	self.Pos = pos
	self.Ang = ang
	return
end	

function SWEP:Think()
	self:DrawWorldModel( )
end

function SWEP:RenderOverride()
	self:DrawWorldModel()
end

function SWEP:OnDrop()
	self.Owner = nil
end

function SWEP:DrawWorldModel( )
local hand, offset, rotate

if not IsValid( self.Owner ) then	
	self:SetRenderOrigin(self.Pos)
	self:SetRenderAngles(self.Ang)
	self:DrawModel( )
return
end

if not self.Hand then
self.Hand = self.Owner:LookupAttachment( "anim_attachment_rh" )
end

hand = self.Owner:GetAttachment( self.Hand )

if not hand then
	--self:SetRenderOrigin(self:GetNetworkOrigin())
	--self:SetRenderAngles(self:GetNetworkAngles())
	self:SetRenderOrigin(self.Pos)
	self:SetRenderAngles(self.Ang)
	self:DrawModel( )
	return
end

offset = hand.Ang:Right( ) * self.Offset.Pos.Right + hand.Ang:Forward( ) * self.Offset.Pos.Forward + hand.Ang:Up( ) * self.Offset.Pos.Up

hand.Ang:RotateAroundAxis( hand.Ang:Right( ), self.Offset.Ang.Right )
hand.Ang:RotateAroundAxis( hand.Ang:Forward( ), self.Offset.Ang.Forward )
hand.Ang:RotateAroundAxis( hand.Ang:Up( ), self.Offset.Ang.Up )

if self.SetRenderOrigin == nil or self.SetRenderAngles == nil then return end

self:SetRenderOrigin( hand.Pos + offset )
self:SetRenderAngles( hand.Ang )

self:DrawModel( )
end