38 lines
951 B
Lua
38 lines
951 B
Lua
local PANEL = {}
|
|
|
|
function PANEL:Init()
|
|
self:SetAvatarRender()
|
|
end
|
|
|
|
local vector_002 = Vector(0, 0, 2)
|
|
|
|
function PANEL:SetAvatarRender()
|
|
local entity = self.Entity
|
|
if IsValid(entity) then
|
|
local boneid = entity:LookupBone("ValveBiped.Bip01_Head1") or entity:LookupBone("ValveBiped.Bip01_Head") or entity:LookupBone("bip01_head")
|
|
if not boneid then
|
|
return
|
|
end
|
|
|
|
local positionEye = entity:GetBonePosition(boneid)
|
|
positionEye:Add(vector_002)
|
|
self:SetLookAt(positionEye)
|
|
|
|
local eyeposing = Vector(0, -250, 0)
|
|
|
|
if boneid == 7 then
|
|
eyeposing = Vector(-360, 25, 0)
|
|
end
|
|
|
|
local camposition = positionEye - eyeposing
|
|
self:SetCamPos(camposition)
|
|
self:SetFOV(5)
|
|
|
|
entity:SetEyeTarget(positionEye - Vector(0, -250, 0))
|
|
end
|
|
end
|
|
|
|
function PANEL:LayoutEntity() end
|
|
|
|
vgui.Register("ixModelAvatarPanel", PANEL, "ixModelPanel")
|