• Need help with attachment angle
    4 replies, posted
I am trying to put a pistol prop on a NPC by using attachments. When I do it, the pistol attaches on the NPC's hand just like where the attachment is at. The problem is, the pistol is facing towards itself and not front. So I tried turning it 180 degrees, but the problem is the game doesn't do anything. If I change the position or the angle, nothing happens. [code] local extragun = ents.Create("prop_physics") extragun:SetModel("models/weapons/w_pistol.mdl") //extragun:SetPos(self:GetPos()+self:GetUp()*54+self:GetForward()*8+self:GetRight()*-7) extragun:SetPos(self:GetPos()) extragun:SetOwner(self.Owner) extragun:Fire("SetParentAttachment","anim_attachment_LH",0) extragun:SetAngles(self:GetAngles() + Angle(0,180,0)) extragun:SetKeyValue("Pitch Yaw Roll", "0 -180 0") extragun:Spawn() extragun:Activate() extragun:SetParent(self) [/code] Thank you for your help.
Replace extragun:SetAngles(self:GetAngles() + Angle(0,180,0)) extragun:SetKeyValue("Pitch Yaw Roll", "0 -180 0") with extragun:SetLocalAngles(Angle(0,180,0))
[QUOTE=Robotboy655;45026171]Replace extragun:SetAngles(self:GetAngles() + Angle(0,180,0)) extragun:SetKeyValue("Pitch Yaw Roll", "0 -180 0") with extragun:SetLocalAngles(Angle(0,180,0))[/QUOTE] Still doesn't work
Parent before you set parent attachment.
[QUOTE=Robotboy655;45026288]Parent before you set parent attachment.[/QUOTE] I tried that too: [code] local extragun = ents.Create("prop_physics") extragun:SetModel("models/weapons/w_pistol.mdl") //extragun:SetPos(self:GetPos()+self:GetUp()*54+self:GetForward()*8+self:GetRight()*-7) extragun:SetPos(self:GetPos()) extragun:SetParent(self) extragun:Fire("SetParentAttachment","anim_attachment_LH",1) extragun:SetLocalAngles(self:GetAngles() + Angle(0,180,0)) extragun:Spawn() extragun:Activate() extragun:SetOwner(self) [/code]
Sorry, you need to Log In to post a reply to this thread.