DModelPanel/SetAnimated

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

Contents

DescriptionPanelFunc

Sets whether or not to animate the entity when the default DModelPanel:LayoutEntity is called.

Arguments

boolean animated

True to animate, false otherwise.

Examples

Example

A comparison between 2 model panels: the first one has animated set to false and the second one has it set to true. Both are using the default DModelPanel:LayoutEntity method.

BGPanel = vgui.Create("DPanel")
BGPanel:SetPos(20, 20)
BGPanel:SetSize(400, 200)
	
-- Left panel
local mdl1 = vgui.Create("DModelPanel", BGPanel)
mdl1:SetPos(0, 0)
mdl1:SetSize(200, 200)
mdl1:SetModel("models/player/mossman.mdl")
mdl1:SetCamPos(Vector(40, 40, 40))

mdl1:SetAnimated(false)

-- Right panel
local mdl2 = vgui.Create("DModelPanel", BGPanel)
mdl2:SetPos(200, 0)
mdl2:SetSize(200, 200)
mdl2:SetModel("models/player/mossman.mdl")
mdl2:SetCamPos(Vector(40, 40, 40))

mdl2:SetAnimated(true)

-- Dance sequence	
local dance = mdl1:GetEntity():LookupSequence("taunt_dance")

-- Make both dance
mdl1:GetEntity():SetSequence(dance)
mdl2:GetEntity():SetSequence(dance)

Output:



DModelPanel SetAnimated example1.jpg
Personal tools
Navigation