Not sure what exactly is causing this - it depends on the situation, but sometimes I’ll have a custom physics-based entity appear to be in one location on the client’s side, but it will be somewhere else on the server’s side. My lua code is really bare-bones, so I’m unsure if I can call this a lua issue or not.
Any clue why this is happening? I imagine is has something to do with the prediction system fucking up, although it seems to happen more often when I set an entity to be a particular material (for instance, “metal_bouncy” always fucks up).
In case it helps, here’s the code.
AddCSLuaFile() DEFINE_BASECLASS( "base_anim" ) ENT.PrintName = "Ball" ENT.Author = "Raubana" ENT.Information = "A ball." ENT.Category = "Other" ENT.Editable = true ENT.Spawnable = true ENT.AdminOnly = true ENT.RenderGroup = RENDERGROUP_OPAQUE function ENT:SpawnFunction( ply, tr, ClassName ) if ( !tr.Hit ) then return end local SpawnPos = tr.HitPos + tr.HitNormal * 200 local ent = ents.Create( ClassName ) ent:SetPos( SpawnPos ) ent:Spawn() ent:Activate() return ent end function ENT:Initialize() self:SetModel( "models/hunter/misc/sphere375x375.mdl" ) self:PhysicsInit(SOLID_VPHYSICS) local phys = self:GetPhysicsObject() phys:EnableMotion(true) phys:Wake() phys:SetMaterial("rubber") end