Hello Facepunch, I have an issue with the animations of my entities.
They are laggy/stuttering
https://files.facepunch.com/forum/upload/185765/f8dee5c2-903c-4d28-a875-710bb00d1ab9/2019-02-16 20-59-17.mp4
This is the code of the entity:
cl_init.lua
include("shared.lua")
function ENT:DrawTranslucent()
self:DrawModel()
// SOME 3D2D Stuff
end
init.lua
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel(self.Model)
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_NONE)
self:SetUseType(SIMPLE_USE)
local phys = self:GetPhysicsObject()
phys:EnableMotion(false)
phys:SetMass(500)
GAMEMODE.PDRaid.BankEntity = self
self:ResetSequence("open")
end
function ENT:Use(ply)
self:ResetSequence("close")
end
function ENT:Think()
if GAMEMODE.PDRaid.BankEntity != self then
GAMEMODE.PDRaid.BankEntity = self
end
/*
self:NextThink(CurTime() + .5)
return true
*/
end
shared.lua
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.Category = "Sonstiges"
ENT.PrintName = "Staatsbank"
ENT.Spawnable = true
ENT.RenderGroup = RENDERGROUP_BOTH
ENT.AutomaticFrameAdvance = true
ENT.Model = Model("models/safe/safe.mdl")
function ENT:SetupDataTables()
self:NetworkVar("String",0,"CurCode")
end
This is due to self:NextThink(CurTime() + .5)
Maybe there's a way to ignore that. But when I test my model animation problem was the same
Its commented out as I already had that suggestion.
Its better without it but not fixed.
Have you try to remove AutomaticFrameAdvance
or
Try add DEFINE_BASECLASS("base_anim")
or
Try use self:SetSequence(self:LookupSequence( "close" )) instead
That causes the animation to not play at all.
Doesnt help, even if I replace
ENT.Base = "base_gmodentity"
with
ENT.Base = "base_anim"
Doesnt work at all, self:ResetSequence(self:LookupSequence( "close" )) gives same result
You must have AutomaticFrameAdvance set to true, and NextThink must be set to CurTIme() every frame.
That's what my issue was, thanks alot!
Sorry, you need to Log In to post a reply to this thread.