Hey everyone, I’m working on a world prop system and have made a quick test code with intentions of trying to find a way to make it so the entity I spawn is solid, but can’t be used (physgun beams go through it… etc). I have managed to come across PhysObj.EnableCollisions, which seems to supposively do what I’m looking for but doesn’t in my case. Instead, the entity is not solid and players can walk through it. Anyways, here’s the code:
function SpawnWorldEntity() local Entity = ents.Create("prop_dynamic") Entity:SetModel("models/props/cs_assault/pylon.mdl") Entity:DrawShadow(false) Entity:SetPos(ply:GetEyeTraceNoCursor().HitPos) Entity:SetAngles(Angle(0, 90, 0)) Entity:Spawn() local phys = Entity:GetPhysicsObject() if IsValid( phys ) then phys:EnableCollisions(true) end end concommand.Add("spawnpylon", SpawnWorldEntity)
Some help would be much appreciated, thanks in advance!