DModelPanel/SetColor

From Garry's Mod
Jump to: navigation, search
 DModelPanel:SetColor( )

Contents

DescriptionPanelFunc

Sets the color of the rendered entity.

NOTE

This does not work on Garry's Mod player models since they use a different color system. To modify a player model color, see Example 2 on the DModelPanel page

Arguments

table color

The render color of the entity.

Examples

Example

Creates a model panel with a red watermelon inside.

local panel = vgui.Create("DPanel")
panel:SetPos(20, 20)
panel:SetSize(200, 200)
	
local mdl = vgui.Create("DModelPanel", panel)
mdl:SetSize(panel:GetSize())
mdl:SetModel("models/props_junk/watermelon01.mdl")
mdl:SetLookAt(Vector(0, 0, 0))
mdl:SetCamPos(Vector(10, 10, 10))
mdl:SetColor(Color(255, 0, 0))

Output:



DModelPanel SetColor example1.jpg
Personal tools
Navigation