SetSequence Not Working for "animating" this model

***UPDATE AS OF 7-24-17:
The issue has been isolated to being a modelling issue so I’ve made a new thread over there.
Incase someone from the future is having the same issue and needs an answer, hopefully it will be in the new thread here:

http://forum.facepunch.com/showthread.php?t=1572529&p=52503561#post52503561***

First off, I’m not sure where to put this thread so move it if needed.
This deals with both LUA and 3d Modelling in Blender.

Issue: SetSequence is not playing the sequence created in the .qc file.

Situation History:
Made a simple 3d object in Blender.
Created 4 objects.
myladder
myladder_idle
myladder_add
myladder_phys

The myladder_add sequence is not playing when called upon.

Everything is all exported and ready to go. The model is working in-game, but when self:SetSequence is called it doesn’t change to the myladder_add animation (or the “add” sequence).


QC File Code:



$modelname "main\props\myladder\myladder.mdl"

$scale 1

$body 1 "myladder.smd"

$cdmaterials "main\props\myladder\"

$surfaceprop "metal"

$contents "solid" "ladder"

$sequence "idle" "anims\myladder_idle.smd" {
fps 1
}

$sequence "add" "anims\myladder_add.smd" {
fps 5
}

$collisionmodel "myladder_phys.smd" {
	$automass
	$inertia 1
	$damping 0
	$rotdamping 0
	$concave
}


Init.lua code for the entity



AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")

function ENT:Initialize()
	self:SetModel("models/main/props/myladder/myladder.mdl")
	self:PhysicsInit(SOLID_VPHYSICS)
	self:SetMoveType(MOVETYPE_VPHYSICS)
	local physobj = self:GetPhysicsObject()
	if physobj and physobj:IsValid() then physobj:Wake() end
	self:Activate()
end
function ENT:Use( activator, caller )
	local sequence = self:LookupSequence( "add" )
	self:SetSequence( sequence )
end


Project Files (Blender file, compiled and raw files, entity lua files)

I am interested in your input. For those of you who may ask:
No, there is no texture yet.
This is a proof of concept.
I know there are other ladders out there, but I need to make my own for my project.
I am asking for assistance, not a critique on my code/modelling skills. Thank you.

UPDATE:
This is how you can test it yourself incase you didn’t know.
Copy the contents of “CROWBAR COMPILED” in “models/main/props/myladder”
Copy the contents of “garrys mod addon” into "lua/entities"

If it’s called myladder_add, shouldn’t you be calling



local sequence = self:LookupSequence( "myladder_add" )


No.

That refers to the sequence name which is

Sorry. I’ll check your addon

If you yourself don’t know anything about this, but you know someone who does. Please point them in the direction of this post. I’d like to get working on this as soon as possible.

  1. Use ResetSequence instead.
  2. Your entity most likely doesnt have automaticframeadvance set
  3. In addition to that, you probably do not override the think function and increase its “tick rate”

I guess this is something I need to document on the wiki better.

[editline]23rd July 2017[/editline]

I added a code for a simple entity with working animations here:

With comments and stuff

init.lua

the qc file

What am I missing? The entity is still stationary.

EDIT:

Picture to show that Crowbar is indeed seeing the two sequences (idle and animation)
The animation for the “animation” sequence is 180 frames long and is just making the box taller is all it is. (Just for testing this quick)

I dont see the AutomaticFrameAdvance in your code anywhere

Set it, still not working. :\

Try to post shared and cl_init.lua so we can see what could be wrong

It’s in the video, but okay…

CL_INIT

INIT

SHARED

When setting autoframeadvance inside a function, you need to use

ENT:SetAutomaticFrameAdvance , I suggest putting ENT.AutomaticFrameAdvance = true into the shared.lua

I just added those in their respective places. Still isn’t working. :frowning:

EDIT:
Made another video showing from scratch the export from Blender using the Blender Source Addon and everything else. I really don’t know what else to say. What am I doing wrong? Is there some special thing that I’m supposed to do when exporting an animation?

I don’t know what else to do guys. This is the most basic thing I could come up with to test and it just doesn’t want to work. Do I need to go talk to the makers of that Blender Addon??

After further investigations I found out that the animations werent exported.So it is not animating because the animations have no animation data. You exported it incorrectly

Edit: You are not making the animations correctly. You need to make an armature(skeleton) for the model, that is how source animates models.

Well… Do I need to have the armature named as source bone names (I briefly looked into it) or am I free to name the bones anything? (I’ll just need to name them correctly in the .qc file I’m sure)

Thanks.

Bones arent stored in the QC, only the SMD. You can use any name you want for the bones in your model.
The basics needed for a model in source is the mesh and the armature. Try to check out some tutorials on youtube about Blender to Source or something like that

Alright will do, I am very familiar with Blender. :slight_smile:

I am surprised that frames like what I used aren’t supported in the export addon. You’d think they would add a way to support that for those of use who done want unnecessary bones in our animations.

I will make a quick test animation and get back to you shortly. Thank you for the information!

Just to avoid any further problems, SMD can only store the bone position and rotation, not the size. So if you were to resize a bone in lets say frame 10 to make a part of the mesh bigger, it would not work, since only the position and rotation is stored. Hope it will be helpful

Sadly, it still isn’t working… though you’ll see in the vid I think Crowbar is only seeing 2 frames of animation… i could be wrong though.

You are probably doing it wrong. The way you have the mesh and armature set up feels oddly wrong to me. Try making just the model with the skeleton, export it, then import it as the .smd and make the animations.