Touble with Entity:SetSequence() (Leg twitches, doesn't advance in animation)
3 replies, posted
I'm trying to make a simple NPC entity, but Entity:SetSequence() isn't working how I thought it would. When I set its sequence, it moves its body into the first frame of the animation, then its legs start twitching rhythmically. Please help!
cl_init.lua
[code]include("shared.lua")
function ENT:Draw()
self:DrawModel()
end[/code]
init.lua
[code]AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/Humans/Group03/male_07.mdl")
self:PhysicsInit(SOLID_BBOX)
self:SetSolid(SOLID_BBOX)
self:SetMoveType(MOVETYPE_CUSTOM)
self:SetSequence("idle_angry")
end[/code]
shared.lua
[code]ENT.Type = "anim"
ENT.AutomaticFrameAdvance = true
function ENT:Think()
self:NextThink(CurTime())
return true
end[/code]
Thanks!
Fixed. The solution was to call self:SetPlaybackRate(1) before calling SetSequence. New problem though: the entity seems to hover 8 or so units above the ground, and refuses to be SetPos()'d back down. Id screenshot it but Im on my phone. Any solution? Thanks
maybe DropToFloor()
I'm not sure what could be causing this myself... maybe you could try screwing about with the collision bounds with NPC:SetCollisionBounds()
Sorry, you need to Log In to post a reply to this thread.