I am using ents.FindInBox to select all entities within my mouse pressed and mouse released vectors. Currently this looks like:
[lua]
function GM:GUIMousePressed( mc, vec )
local tr = util.QuickTrace( LocalPlayer():GetShootPos(), vec * 10000, LocalPlayer() )
MP = tr.HitPos
end
function GM:GUIMouseReleased( mc, vec )
local tr = util.QuickTrace( LocalPlayer():GetShootPos(), vec * 10000, LocalPlayer() )
MR = tr.HitPos
end
function SelectEnt( MP, MR )
for k, v in pairs( ents.FindInBox( MP, MR ) ) do
table.insert( SelectedEnts, v )
end
return SelectedEnts
end
[/lua]
This is just a basic recreation of my code. ents.FindInBox works perfectly about 75% of the time. The other 25% it blatantly ignores entities within the mouse press and release vectors. Sometimes it selects entities outside of the vectors as well. If I select a single entity, rather than dragging my mouse for multiple entities, it works 100% of the time.
Thanks for any help or solutions you can provide.
Just in case you don't know, the 'box' will not rotate, it will always stay aligned to the X and Y axises.
[QUOTE=Robotboy655;44299808]Just in case you don't know, the 'box' will not rotate, it will always stay aligned to the X and Y axises.[/QUOTE]
This is my third day tinkering with LUA, so unfortunately I failed to realize this. Is there any way to make a selection box that can rotate?
[QUOTE=Charades;44299981]This is my third day tinkering with LUA, so unfortunately I failed to realize this. Is there any way to make a selection box that can rotate?[/QUOTE]
No. But you can use spheres.
[QUOTE=Robotboy655;44300584]No. But you can use spheres.[/QUOTE]
Alright thanks for the clarification and help.
Sorry, you need to Log In to post a reply to this thread.