Garry's Mod Wiki

Garry's Mod Wiki

  DModelPanel:SetLookAt( Vector pos )

Description

Makes the panel's camera face the given position. Basically sets the camera's angles (DModelPanel:SetLookAng) after doing some math.

Arguments

1 Vector pos
The position to orient the camera toward.

Example

Creates a model panel focused on Colonel Odessa Cubbage's face.

BGPanel = vgui.Create("DPanel") BGPanel:SetPos(20, 20) BGPanel:SetSize(200, 200) local mdl = vgui.Create("DModelPanel", BGPanel) mdl:SetSize(BGPanel:GetSize()) mdl:SetModel("models/player/odessa.mdl") function mdl:LayoutEntity( Entity ) return end -- Disable cam rotation local headpos = mdl.Entity:GetBonePosition(mdl.Entity:LookupBone("ValveBiped.Bip01_Head1")) mdl:SetLookAt(headpos) mdl:SetCamPos(headpos-Vector(-15, 0, 0)) -- Move cam in front of face --mdl.Entity:SetEyeTarget(headpos-Vector(-15, 0, 0)) -- Makes Odessa look at the camera -- Commented out because the result is funnier without this
Output:

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...