Trace Hardly Detects Player

So a long time ago I made my own tripmine from GM12, and I’m converting it to GM13. The reason I’ve not done it sooner is because the trace only detects players about 50% of the time.

Detection Method:
–In an initialization function
self.trd = {}; self.trd.start = self:GetPos(); self.trd.endpos = tr.HitPos; self.trd.filter = self

function ENT:Think()
if self.Calibrated then
local tr = util.TraceLine( self.trd )
if IsValid( tr.Entity ) and tr.Entity:IsPlayer() then
self:DoExplode( tr.Entity )

I’ve tried doing self:NextThink( CurTime() + 0.0001 ) but that doesn’t change anything.

A snippet from the DarkRP Hud code, might be useful? You could try to widen the scope of the tracing,

	local shootPos = localplayer:GetShootPos()
	local aimVec = localplayer:GetAimVector()

	for k, ply in pairs(player.GetAll()) do
		if not ply:Alive() then continue end
		local hisPos = ply:GetShootPos()
		if ply:getDarkRPVar("wanted") then DrawWantedInfo(ply) end

		if GAMEMODE.Config.globalshow and ply ~= localplayer then
		-- Draw when you're (almost) looking at him
		elseif not GAMEMODE.Config.globalshow and hisPos:Distance(shootPos) < 400 then
			local pos = hisPos - shootPos
			local unitPos = pos:GetNormalized()
			if unitPos:Dot(aimVec) > 0.95 then
				local trace = util.QuickTrace(shootPos, pos, localplayer)
				if trace.Hit and trace.Entity ~= ply then return end

I’m not very familiar with Vectors/Angles and manipulating them, how would I do that? It sounds like a nice try.

To be honest, nor am I, I just know that that was somewhat relevant.

Try small hulltraces instead.

Seems to be much more reliable, but still misses it rarely. ( Just replaced util.TraceLine with util.TraceHull ) Anyone mind explaining the difference between the too?

Think of TraceLine as a single pixel in width (and height)
Tracehull uses a box instead of a line.

You should avoid traces for tripmines. A hull trace is better than what you’re doing but the best solution is to set a custom collision box for a “laser” entity that triggers when a player touches it.

self.Entity:SetCollisionBoundsWS( self.Entity:GetPos( ), endpos, Vector( ) * 0.25 )

Thanks for both of the responses. I’ll try the Collision Box tomorrow and see if that works better.

Before you try any weird solution, try using self:NextThink(CurTime()) and then returning true. If I remember correctly, NextThink doesn’t take effect unless you return true from the Think function.