DModelPanel:SetLookAng
Description
Sets the angles of the camera.
Arguments
Example
Creates a model panel with Eli rotating normally and the camera angles rotating sideways.
BGPanel = vgui.Create("DPanel")
BGPanel:SetPos(20, 20)
BGPanel:SetSize(400, 400)
BGPanel:SetBackgroundColor(Color(0, 0, 0, 255))
local mdl = vgui.Create("DModelPanel", BGPanel)
mdl:SetSize(BGPanel:GetSize())
mdl:SetModel("models/eli.mdl")
-- Position camera
mdl:SetCamPos(Vector(0, 60, 36))
local yaw = 0
function mdl:LayoutEntity(ent)
-- Point camera toward the look pos
local lookAng = (self.vLookatPos-self.vCamPos):Angle()
-- Rotate the look angles based on incrementing yaw value
lookAng:RotateAroundAxis(Vector(0, 1, 0), yaw)
-- Set camera look angles
self:SetLookAng(lookAng)
-- Make entity rotate like normal
ent:SetAngles(Angle(0, RealTime()*30, 0))
yaw = yaw + 1
end
Output: 
