Trace check

How can I check when my trace “leaves” an entity ?

[lua]

local OldHitting = false

hook.Add(“Think”,“TraceCheck”,function()

local trace = LocalPlayer():GetEyeTrace()
local hitting = trace.Entity:IsValid()

if hitting == false and OldHitting == true then
print(“Stopped hitting the entity!”)
end

OldHitting = hitting
end)

[/lua]

Something like that would work, if i understood you correctly.

Thank you. I’m working on some sort of penetration type.
I want to dispatch a trace through an entity and then check if it left the entity or not.

Sorry for not expressing it as clear as I should :stuck_out_tongue:

Look at FractionLeftSolid.

Thanks broski