Garry's Mod Wiki

DModelPanel

Description

DModelPanel is a VGUI element that projects a 3D model onto a 2D plane.

Parent

Derives from DButton.

Example

Creates a DModelPanel and sets its model to your playermodel.

local Panel = vgui.Create( "DPanel" ) Panel:SetPos( 10, 10 ) Panel:SetSize( 200, 200 ) local icon = vgui.Create( "DModelPanel", Panel ) icon:SetSize( 200, 200 ) icon:SetModel( LocalPlayer():GetModel() )

Example

Creates a DModelPanel and sets its model to the Alyx playermodel, then changes its player color to red. Also disables default rotation animation.

local Panel = vgui.Create( "DPanel" ) Panel:SetPos( 10, 10 ) Panel:SetSize( 200, 200 ) local icon = vgui.Create( "DModelPanel", Panel ) icon:SetSize(200,200) icon:SetModel( "models/player/alyx.mdl" ) -- you can only change colors on playermodels function icon:LayoutEntity( Entity ) return end -- disables default rotation function icon.Entity:GetPlayerColor() return Vector (1, 0, 0) end --we need to set it to a Vector not a Color, so the values are normal RGB values divided by 255.
Output:

Page Links


Special Pages


Wikis

?

Render Time: 27ms

DB GetPage 3
Generate Html 2
SaveChanges (1) 8
Render Body 0
Render Sidebar 12