Alternatives to gamemode hook ShouldCollide?

I tried putting the ShouldCollide hook in a shared setting but the prediction sucks absolute dick.

I also tried looping through the players and checking if an entity is penetrating one of the players (But that only works 50% of the time)
I even tried using ents.FindInSphere
[lua]
for k,v in pairs(player.GetAll()) do
for _,getprop in pairs( ents.FindInSphere( v:GetPos(), 13 ) ) do
end
end
[/lua]

That sucks as well. Hell, I even mixed them together but the detection only works about 9 times out of 10.

Also I forgot to mention ShouldCollide doesn’t seem to let you physgun the prop after returning false. Anyway to get past this?

I think it’s because the ShouldCollide hook is polled, and not called when 2 things actually DO collide.

yeah I figured that too - any suggestions on alternatives?
The other methods I said work alright but don’t always work - or maybe I’m not using them right?

Could you explain what you want to happen exactly, like when you want them to collide or not and so on.

I’m trying to detect if a prop is trying to be pushed towards a player or if the player is stuck inside a prop.

I want the prop not to collide with the player if it’s velocity is high or if the player is inside the prop.
I managed to do it sort of, but then after i tested it out on a player after that whenever a prop was spawned they would fall through the world.

Can you just make the prop nocollide upon spawn and upon physgun pickup? Then just check if the prop is colliding with a player or not every so often and if it isn’t then make it solid. For the physgun I’d just do the check on physgun drop.
You could probably just do a a timer or a recursive function with a delay that runs every 0.1 seconds or something similar.

But I’m trying to detect if the prop is colliding with a player…

Here is a snippet of an old code I have. I know it’s in physgundrop but it’s an example
[lua]function PhysgunDrop( ply, ent )

local tr = {}
tr.start = ent.StartPos
tr.endpos = ent:GetPos()
tr.filter = Ents

local trace = util.TraceLine(tr)
tr.start = ply:GetShootPos()
tr.filter = ply

local trace2 = util.TraceLine(tr)

for k,v in pairs(player.GetAll()) do
	local intr = {}
	intr.start = v:EyePos()
	intr.endpos = v:GetPos()
	intr.filter = v
	intr.mins = v:OBBMins()
	intr.maxs = v:OBBMaxs()
	local trace3 = util.TraceHull(intr)
	if trace3.Entity == ent then 
		local p = ent:GetPhysicsObject()
		if p:IsValid() then
			-- do what you wanna do here
		end
	end 
end

end
hook.Add( “PhysgunDrop”, “PhysgunDrop”, PhysgunDrop )[/lua]

Ah I see. Brilliant, thanks!