Checking if prop is in player

Hello, For some odd reason the COLISSION_GROUP isn’t working as intended too. I added a command to force the collission on the prop, but yet player and props are still solid when they should be able to pass through it if i’m holding it with the physgun.



local function PhysgunPickup(ply, ent)
	ent:SetColor(0, 0, 100)
	if ent:GetClass() == "prop_physics" then
	ent:SetCollisionGroup(COLLISION_GROUP_WORLD)
	local entcol = {ent:GetColor()}
	ent:SetColor(Color(255,255,255,150))
	ent:SetRenderMode( RENDERMODE_TRANSALPHA )
	end
end
hook.Add("PhysgunPickup", "Pickup", PhysgunPickup)


local function PhysgunDrop(ply, ent)
	if ent:GetClass() == "prop_physics" then
	ent:SetCollisionGroup(COLLISION_GROUP_INTERACTIVE)
	ent:SetColor(Color(255,255,255,255))
	ent:SetRenderMode( RENDERMODE_TRANSALPHA )
	end
end
hook.Add("PhysgunDrop", "Drop", PhysgunDrop)


concommand.Add( "SetCollision", function( ply )
    local ent = ply:GetEyeTrace().Entity
    print(ent)
    ent:EnableCustomCollisions(true)
    ent:SetCollisionGroup(COLLISION_GROUP_WORLD)
    print(ent:GetCollisionGroup())
end )



Entity [185][prop_physics]
20

is what it prints out to console.

Here is how the prop is acting while it’s set at COLLISION_GROUP_WORLD

[editline]12th January 2017[/editline]

Ignore the name, I was going to put something else in here but then discovered this issue.

What I was originally going to seek help for was using util.TraceHull() to check if a player is in a prop and if so nocollide the prop and once no player is in prop, or prop is dropped it’ll make it solid once again.

Still need help.

Still looking for assistance?

https://github.com/mcNuggets1/mg_anticrash/blob/master/lua/mg_anticrash/sv_anticrash.lua#L79

Use this as example.

Ah… Thanks!