tr.HitNormal returns zero vector even if hits world
5 replies, posted
I have an issue with trace HitNormal. I have an entity and trace to check if it is stuck in world:
local tr = util.TraceHull({
start = ent:GetPos(),
endpos = ent:GetPos(),
mins = Vector(-8,-8,-8),
maxs = Vector(8,8,8),
filter = ent
})
I need to get normal vector where it hits the world, so I check:
if tr.HitWorld then
print(tr.HitNormal)
end
The issue is that tr.HitNormal always returns zero vector. Seems really weird for me.
Your start and end position are the same.
What should I put there if I need to check if the hull hits world?
A position that isn't exactly the same?
How do you expect a point to have a direction?
But... it has the hull box
What do I do?
The trace appears to work properly as per your example the tr.HitWorld check does pass. Just do a second trace if tr.HitWorld is true.
Sorry, you need to Log In to post a reply to this thread.