Faulty physics on test entity only when spawned using ents.Create

Hi all, I’m having trouble spawning an entity I recently made. For my addon I need to spawn the entity using a tool. However, when I spawn it via ents.Create I can walk straight through it and I can’t pick it up with the physgun or gravity gun, and bullets pass through it too. It does however respond to gravgun punting and collisions with other entities.

I’ve created a smaller test-entity which only has the necessary parts to re-create the problem (acf_spawntest.lua):


DEFINE_BASECLASS( "base_wire_entity" )
ENT.Type            = "anim"
ENT.Base            = "base_wire_entity"

if SERVER then

    function MakeACF_SpawnTester(Owner, Pos, Angle, Id)
        local ent = ents.Create("acf_spawntest")
        if not ent:IsValid() then return false end
        ent.Owner = Owner
        return ent

    function ENT:SetModelEasy(mdl)

        self:SetModel( mdl )    
        self.Model = mdl
        self:PhysicsInit( SOLID_VPHYSICS )          
        self:SetMoveType( MOVETYPE_VPHYSICS )         
        self:SetSolid( SOLID_VPHYSICS )
        local phys = self:GetPhysicsObject()      
        if (phys:IsValid()) then 


You can use the following line in the console to invoke the ‘MakeACF_SpawnTester’ function:

lua_run local ply = player.GetAll()[1] MakeACF_SpawnTester(ply, ply:GetPos() + Vector(0,0,20), Angle(0,0,0))

I need to be able to spawn the entity without problems via MakeACF_SpawnTester because it’s registered as a duplicator factory for the full entity.

Here’s a video displaying the symptoms:


What’s going wrong? Has anyone seen this before? Can anyone help?! Much thanks up front!

Pretty sure it’s caused by SetOwner, which disables player collisions with the entity, among other things.

Completely correct, that sorted it out! As you can imagine, I was trying to set the entity’s owner for prop protection systems and I thought that’d do it. What’s the right way to do that? Do I even need to worry about that?

The method is entirely dependent on the prop protection system you are using.

Alright, well I’ll make an attempt using CPPI and if that isn’t supported on the server then I guess it’s up them. Thanks for all your help, that one had my mind blown for far too long.