DModelPanel continous animation or pose

Hi guys, so I have a DModelPanel, and I want the model to hold a pose or animation. Here is the code:


	local mdl = vgui.Create( "DModelPanel", self.info )
	mdl:SetModel( team_model )
	mdl:SetPos( self:GetWide() * 2, 25 )
	mdl:SetSize( 256, 256 )
	mdl:SetAnimated(true)
	
	local dance = mdl:GetEntity():LookupSequence( "taunt_robot" )
	mdl:GetEntity():SetSequence( dance )

And this works fine, but after the sequence ends, it goes into an ugly T pose like here:

I just want the model to hold a pose or repeat an animation, I am not sure how to do this. Thanks in advance!

Try using

Entity:SetCycle and

Entity:GetCycle. If you wanted to repeat the animation, you could do something like this:



function modelpanel:LayoutEntity( ent )
	if ( ent:GetCycle() >= 0.95 ) then -- 1 is the maximum cycle number
		ent:SetCycle( 0.5 )
	end
end


Or, if you wanted it to pause, you could do



function modelpanel:LayoutEntity( ent )
	if ( ent:GetCycle() > 0.5 ) then
		ent:SetCycle( 0.5 )
	end
end


That’d reset the animation to halfway if it went past the halfway point, but it’d probably be better to just stop the animation (which you could probably figure out how to do)

Thank you, now he holds a pose!