Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- how do i make it so a's head follows b's head?
- local print = epoe.Print
- SafeRemoveEntity(cs_mdl) local a = ClientsideModel("models/player/combine_super_soldier.mdl") cs_mdl = a
- local b = Entity(465)
- a:SetPos(b:GetPos() + VectorRand() * 50)
- local function find_bone(ent, str)
- for i = 0, ent:GetBoneCount() do
- local name = ent:GetBoneName(i)
- if name:lower():find(str) then
- return i
- end
- end
- end
- hook.Add("Think", 1, function()
- local head1 = find_bone(a, "head")
- local head2 = find_bone(b, "head")
- -- reset so it doesn't become additive
- a:ManipulateBonePosition(head1, Vector(0,0,0))
- a:ManipulateBoneAngles(head1, Angle(0,0,0))
- -- ???????????????????
- local pos1, ang1 = a:GetBonePosition(a:GetBoneParent(head1))
- local pos2, ang2 = b:GetBonePosition(head2)
- local pos, ang = WorldToLocal(pos1, ang1, pos2, ang2)
- -- ~??????????????????
- a:ManipulateBoneAngles(head1, ang)
- a:ManipulateBonePosition(head1, pos)
- end)
Advertisement
Add Comment
Please, Sign In to add comment