Weird prop collision

I’m attempting to spawn entities into my server on start up using the code:

local spawnPosD = {}

spawnPosD["rp_downtown_v4c_v2"] = { 
	{Vector(-1901.000000, 172.218750, -124.187500), Angle(0.000, 90.000, 0.000)},
	{Vector(-1430.406250, -7157.531250, -141.250000), Angle(0.000, 90.000, 0.000)},
	{Vector(-2911.593750, -1662.437500, -144.531250), Angle(0.000, 0.000, 0.000)},
	{Vector(-3562.375000, 1044.500000, -137.906250), Angle(0.000, 90.000, 0.000)},

timer.Simple(1, function()

	for k,v in ipairs(spawnPosD[string.lower(game.GetMap())]) do
		local pdvault = ents.Create("pd_vault")

The only problem is that when these entities spawn, sometimes they have a really weird, almost force field like, bounding box. This ‘force field’ makes it impossible to walk and just pushes a player back when they get close.

Here is the code when I initialize the entity:

function ENT:Initialize()
    local phys = self:GetPhysicsObject()
	if (phys:IsValid()) then

Why is it like this? Is there any way to fix this?

Use that hook to spawn them instad of a timer. You could be running before the serrver has loaded the map fully.

Would this cause the weird force field in front of the entities?

Here’s a simple tool I made to help with creating entity spawns: - Lua only:

Basically, load up sandbox or whatever… Spawn the entities where you want them on the map, then simply type in console: dev_buildspawns entity_name

like: dev_buildspawns npc_kleiner

It’ll then create a file called EntitySpawnPoints.txt in your data/ folder. You rename this to sv_spawn_entityname_mapname.lua and drop it into addons/acecool/lua/autorun/server/

You can do it differently if you want, but it is a useful tool to learn how you can do it. I do it differently in my game-mode and my dev_base ( because there’s an entire map library for spawning entities, removing them, altering textures, etc… ) but this will work as a stand-alone system.

[editline]15th March 2015[/editline]

What do you mean by force-field? Do you mean when the client walks into it, it bounces back and forth?? If so, that means the SERVER has the model / physics model and is preventing the CLIENT from walking through the prop, but the CLIENT doesn’t have it so it thinks it’s air…

If only the CLIENT has the physics prop, but not the SERVER, then the CLIENT will move through the prop but it’ll feel like you’re walking through chest-high water ( sluggish ).

Yes Acecool, it’s like trying to walk though mud. I walk forward a ways away from the entity and then I get pushed back and it’s hard to walk forward. Is it because of one of my settings when I initialize the entity?

Are you running this code on the server or the client? It should only be on the server, in the InitPostEntity hook.

It was being run on the server. But I didn’t have it in the proper hook. It’s fixed now. Also, on the entity I set the movement to false on spawn, which seemed to help.