I just did a weird discovery today for something I am not sure why it is applied that way.
I make isometric like levels where upon touching things the player is able to move there.
(1000+ objects on a layout)
For the Level I have various elements such as: floorslabs, stairs, etc.
I generally put these in a "clicklevel" family, and in a loop for player control I have "Is touching object" combined with distance checking from the player to the touch. (compare 2 values, distance(p.x,p.y,touch.x,touch.y) > x) (see image)
Now, when being in touch, I noticed, the mere ~10 collision check per tick goes up to ~500, causing a bit of performance dent, nothing disturbing, but a huge number in relation to the optimized ~10.
I was wondering why it goes up to ~500, so I tried some things, one of them was adding a "Is on screen" event in the "is touching" and distance check.
Suddenly my collision checks dropped from ~500 to ~80 per tick.
Why is the "Is on screen" influencing the touch event. ?
Is it because of the distance check ? It should not, because that is in relation to another object.
I would guess that the "Is touching" is taking ALL Clicklevel family objects in consideration.
And adding the Is on screen limited that ?
IF, that is the case, would this not be a weird mechanic, seeing as one would not be able to click outside of the viewport to start with ?