Category:DModelPanel

From Garry's Mod
Jump to: navigation, search

Contents

DescriptionPanelPage

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

Inherited Functions

Inherits the following functions from DButton and its parents up to 3 levels deep:


Examples

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() )


Examples

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:



dmodelpanel color.jpg
Personal tools
Navigation