Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local trace=easylua.FindEntity'Pyth':GetEyeTraceNoCursor()
- local bot=easylua.FindEntity'Bot02'
- local dist=math.huge
- local boneid=-1
- local pos=trace.HitPos
- for i=0,bot:GetBoneCount()-1 do
- local a=bot:GetBonePosition(i)
- local newdist=a:Distance(pos)
- if newdist < dist then
- dist=newdist
- boneid=i
- end
- end
- local bpos,bang=bot:GetBonePosition(boneid)
- local pos2,ang2=WorldToLocal(pos,(trace.StartPos-trace.HitPos):Angle(),bpos,bang)
- print(pos2,ang2)
- if SERVER then return end
- if a and IsValid(a) then a:Remove() end
- a=ClientsideModel"models/props_trainstation/trainstation_post001.mdl"
- hook.Add('Think',1,function()
- local bpos,bang=bot:GetBonePosition(boneid)
- local pos3,ang3=LocalToWorld(pos2,ang2,bpos,bang)
- a:SetPos(pos3)
- a:SetAngles(ang3)
- end)
Advertisement
Add Comment
Please, Sign In to add comment