• Making a flag move with players back.
    10 replies, posted
[lua]local BoneIndx = ent:LookupBone("ValveBiped.Bip01_Spine") local BonePos , BoneAng = ent:GetBonePosition( BoneIndx ) local flag = ents.Create("prop_dynamic") flag:SetModel("models/props_c17/GasPipes006a.mdl") flag:SetPos(BonePos) flag:Spawn() flag:Activate() //constraint.Weld(ent,flag,BoneIndx,0,0,true) flag:SetNotSolid(true) flag:SetColor(team.GetColor(teamNum))[/lua] This is ran serverside when the flag is picked up. I have tried parenting and weld with no luck. Anyone able to point me in the right direction as i don't want to use think and setpos cause it gets choppy.
[lua]hook.Add("Think","FlagMovement",function() flag:SetPos(--[[put the owner pos here with an offset]]--) end)[/lua]
[QUOTE=Science;30141339][lua]hook.Add("Think","FlagMovement",function() flag:SetPos(--[[put the owner pos here with an offset]]--) end)[/lua][/QUOTE] The problem with this is it is very choppy. I used the same method they used for making hats and its client side rather then server side.
You could try taking a look at the OCRP or cider gamemode to see how they do it.
[quote]Child entities will move with the parent entity.[/quote] [URL]http://wiki.garrysmod.com/?title=Entity.SetParent[/URL] Is that any help?
Use a ClientsideModel and move it in the PostPlayerDraw hook
Was going to suggest parenting it to the player, but someone beat me to it.
[QUOTE=Science;30145072]You could try taking a look at the OCRP or cider gamemode to see how they do it.[/QUOTE] Or you could stop posting when you have no idea what your talking about ma automerg
Well apart from hes said that parenting it to a player does not work.
Why don't you try Entity:SetAttachment(ID) then make the player it's parent?
If memory serves me right, you don;t have to parent something once it's bound to an attachment.
Sorry, you need to Log In to post a reply to this thread.