I've been having an issue with the behavior of ogl.getModels();
So in this situation I am trying to find the model with the ID: 2744849415
I know there are 3 beam models, only 2 have uptext, and only the closest one to the left(in the pic) can be clicked on the other you can't reach(far right).
ClientCenter: ({X = 400, Y = 300})
If I print out the models...
Code:
[{ID = 2744849415, TID = 2, X = 801, Y = 616}, <-- Rightmost beam, has uptext, out of reach IGNORE THIS ONE
{ID = 2744849415, TID = 3, X = 566, Y = 385}, <-- Leftmost beam, has uptext, WE WANT TO CLICK ON THIS ONE
{ID = 2744849415, TID = 2, X = 607, Y = 385}] <-- Middle beam, no uptext, ignore this one
The model we want to click on is {ID = 2744849415, TID = 3, X = 566, Y = 385} but when I use...
Simba Code:
p := clientCenter.closest(ma)[0].randomizePointEllipse(ellipseSize);
It will bring the point to {ID = 2744849415, TID = 2, X = 607, Y = 385} which is the middle beam...
If I create a search box and search for it like
Simba Code:
ogl.getModels(intToBox(520, 355, 600, 400));
I get the following as a result...
Code:
...
{ID = 2744849415, TID = 3, X = 566, Y = 385}
...
So our model(amongst others) shows up in the search box, and only once just as it should.
But if I call...
Simba Code:
ogl.getModels(2744849415, intToBox(520, 355, 600, 400));
I get
Code:
[{ID = 2744849415, TID = 2, X = 607, Y = 385}]
So you see, it is somehow grabbing the middle beam from the printout earlier, despite it existing outside the search bounds, and ignoring the one that exists inside of the search box. Both exist in the world at the same time, the IDs aren't changing, the printouts look exactly as they do. When closest is called, it returns the middle one but only sometimes as the other times it will work fine. When it isn't working properly, I still can see all 3 models(in the printout and onscreen debug) so it's not that the ID is changing. I'm not sure what I'm doing wrong or what's wrong but I can teamviewer this.