Help with animating to Garry's mod.

Hello Facepunch

It has been a long time, months as i’ve been trying my hardest, being very eager to try and fix this solution. Wel, ofcourse what I’m trying to do is animate a very simple box which moves on its bones. I’ll then be able to call them whenever I like i.e when a player uses the entity, the animation will fire.

Here is my .qc file code.



$modelname		"test/wigglyPiggly_v1.mdl"

$cdmaterials	"models/test"

$surfaceprop "metal"

$body "Body" "Cube.smd" 

$sequence "move" "startmove.smd" snap fps 30

$sequence "close" "closemove.smd" snap fps 30

$sequence "idle" "idle.smd" snap fps 1



$collisionmodel "Cube.smd"
{ 
	$mass 100
	$concave
}



And below here is my entity’s Init.lua code.



function ENT:Initialize()
	self:SetModel("models/test/wigglypiggly_v1.mdl")
	self:PhysicsInit(SOLID_CUSTOM)
	self:SetMoveType(MOVETYPE_VPHYSICS)
	self:SetSolid(SOLID_VPHYSICS)

	local sequence = self:LookupSequence( "idle" )
	self:SetSequence( sequence )


	local phys = self:GetPhysicsObject()
	
	if(IsValid(phys)) then
		phys:Wake()
	end
end

function ENT:Use(act, call)
	local sequence = self:LookupSequence( "move" )
	self:SetSequence( sequence )


end



Now, the issue here is, the animations play fine in Hl2 model viewer but as soon as I try to interact with this in-game, just nothing. If any could please help Ive been having this issue for atleast 3 months now and I’m unable to get my head around it.

Thank you for your help.

Try ResetSequence instead of SetSequence.

What’s the difference between ResetSequnce & SetSequence?

It’s the same than doing

ent:SetCycle(0)
ent:SetSequence(seq)

Try to add ENT.AutomaticFrameAdvance = true

Okay, I’ll drop this’ ENT.AutomaticFrameAdvance = true’ in shared, I’ll see what happens.