Garry's Mod Wiki

DModelPanel:SetColor

  DModelPanel:SetColor( table color )

Description

Sets the color of the rendered entity.

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

1 table color
The render color of the entity.

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: