Player can walk right through this fence entity? Help with collision on entities
6 replies, posted
Hello! I need some help with making a fence entity in my gamemode. When it spawns, players can walk right through the fence, which isn't what I want. Any advice on this would be useful! Thanks!
CODE:
local fence = ents.Create("prop_physics")
function SpawnFence()
fence:SetModel("models/props_c17/fence02b.mdl")
fence:SetPos(Vector(-504.616699, 11696, 560.031250))
fence:SetCollisionGroup( 5 )
fence:SetAngles(Angle(0,0,0))
fence:Spawn()
end
Have you tried other collisiongroups like 0 etc?
Yes, and it still didn't work.
I tested the exact code you posted on a local multiplayer server and was able to collide with the fence. Make sure you have no additional collision code being applied to the prop/player that would cause it to not work.
Is it because I have the fence spawn as soon as the server starts?
function GM:Initialize()
SpawnFence()
end
I believe you can use prop_static but you'll have to initialise your own physics object with Entity
This worked, thanks so much dude!
Sorry, you need to Log In to post a reply to this thread.