Entity:IsPointInCollisionBox ?!

Hello,

All is said in the title i just need a function to check if a point is in an entity’s collision box.

I already tried with util.TraceLine, but it’s not working.

My code :



//veh is the used entity
//ply is the player who uses this entity
local pos = veh:WorldToLocal(veh:GetPos())
			pos:Add(Vector(-50, 0, 0))
			
			local trace = util.TraceLine({start = pos, endpos = pos, filter = nil, mask = MASK_SOLID})
			if (IsValid(trace.Entity)) then
				pos = veh:WorldToLocal(veh:GetPos())
				pos:Add(Vector(50, 0, 0))
			end
			
			ply:SetPos(veh:LocalToWorld(pos))


How did traceline not work for you?

Doesn’t found any entity. In plus with some test it never found any entity when i use it !

[editline]18th February 2015[/editline]

Have you any idea about how to detect if a vector is into a vehicle or not ?


for k, v in pairs( ents.GetAll( ) ) do
  if hitpos:WithAABox( v:WorldSpaceAABB( ) ) then
    --Inside another ent's space
  end
end

Maybe?

Ow sh** i finaly arrived ! util.TraceLine was expecting world vectors. After i translated back to world vectors, util.TraceLine is now able to detect when a point is in the vehicle.

Also, anyway, vehicle exit positions are officialy no longer broken !