• World Model reposition script
    4 replies, posted
So i have this script that move the world model of a weapon so it doesnt appear in the center of the player model but the issue is when the weapon is dropped everyone but the person who dropped it sees it floating in mid air does anyone know how i can fix this? [LUA] SWEP.Offset = { Pos = { Up = 0, Right = 4, Forward = -4, }, Ang = { Up = 0, Right = 0, Forward = 0, } } function SWEP:DrawWorldModel( ) local hand, offset, rotate if not IsValid( self.Owner ) then 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: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 ) self:SetRenderOrigin( hand.Pos + offset ) self:SetRenderAngles( hand.Ang ) self:DrawModel( ) end [/LUA]
You know, you could just use swep creation kit for this. Set the weapon to not draw the world model, then create a world weapon element in the correct place. Just my idea on how to do this. [URL="http://steamcommunity.com/sharedfiles/filedetails/?id=109724869"]http://steamcommunity.com/sharedfiles/filedetails/?id=109724869[/URL]
Does the world model actually have physics? Can you spawn it as a prop?
[QUOTE=mishappp;40248888]Does the world model actually have physics? Can you spawn it as a prop?[/QUOTE] when i use the weapons without the repositioning it drops fine hits the ground bounces but the world model is seen in the center of the player model but when i use the repositioning its like its physics have been removed when its dropped im pretty sure i need to stop the function when the weapon is dropped but im a noob so im not sure how to do that
Make sure you aren't manually setting self.Owner to something in the weapon. The code specifically does not continue if self.Owner isn't valid.
Sorry, you need to Log In to post a reply to this thread.