So I've done a bit of debugging:[LUA]if ent1:GetPos():Distance(ent2:GetPos()) < 500 and !ent1.Printed then print(CurTime(), "Distance") ent1.Printed = true end
for _,entity in pairs(ents.FindInSphere(ent1:GetPos(), 450)) do
if entity == ent2 and !entity.Printed then
print(CurTime(),"Sphere")
entity.Printed = true
end
end[/LUA]I basically pull the ent1 closer to the ent2. Entity found with ents.FindInSphere() will always get printed first, doesn't matter that its 50 units less than with distance. It runs normally when lowered by 100 units or so. It doesn't matter which piece of code gets ran first.
So is this a bug? Or does this have to be like this?
GetPos doesn't return the position of the entire entity. FindInSphere checks if any part of the entity is in the sphere I believe.
So are you trying to spawn/drag entity2 closer to entity1?
[QUOTE=|FlapJack|;25877345]GetPos doesn't return the position of the entire entity. FindInSphere checks if any part of the entity is in the sphere I believe.[/QUOTE]
This is correct.
[QUOTE=|FlapJack|;25877345]GetPos doesn't return the position of the entire entity. FindInSphere checks if any part of the entity is in the sphere I believe.[/QUOTE]Oh, thats cool, I thought it just searches for entities OBB center.
Sorry, you need to Log In to post a reply to this thread.