Garry's Mod Wiki

Garry's Mod Wiki

  DModelPanel:SetAnimSpeed( number animSpeed )


Sets the speed used by DModelPanel:RunAnimation to advance frame on an entity sequence.

Entity:FrameAdvance doesn't seem to have any functioning arguments and therefore changing this will not have any affect on the panel entity's sequence speed without reimplementation. It only affects the value returned by DModelPanel:GetAnimSpeed


1 number animSpeed
The animation speed.


A reimplementation of DModelPanel:LayoutEntity which will modify the entity's sequence playback rate based on the set animation speed. This example has Alyx run twice as fast as normal.

local mdl = vgui.Create("DModelPanel") mdl:SetPos(20, 20) mdl:SetSize(200, 200) mdl:SetModel("models/alyx.mdl") -- Play sequence twice as fast mdl:SetAnimSpeed(2) -- Make Alyx run mdl:GetEntity():SetSequence(mdl:GetEntity():LookupSequence("run_all")) -- Play animation function mdl:LayoutEntity(ent) -- Playback rate based on anim speed ent:SetPlaybackRate(self:GetAnimSpeed()) -- Advance frame ent:FrameAdvance() end

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...