Region3 versus manual detection; are either of them better for performance?

  1. What do you want to achieve?

I am creating a basic anticheat that checks if players are within an area of the game that is accessible. If the server does not detect the player in any one of those areas, it will reset them.

  1. What is the issue?

I already know ways I can do this, I can use Region3 to detect parts or I can check manually using some basic math and the positions of the characters. The issue is I’m not sure which one would be better for performance, as maybe Region3 has optimizations that make it faster than checking manually.

Which is better for performance? Or do they not have enough difference for it to matter?

Just do it the math way, region 3 checks using voxels and only finds things in a general area instead of being precise, and they are also pretty expensive I think

1 Like

Good to know, but I don’t know if precision is a huge concern here. Do you know why they’re more expensive?

Well first the function has to calculate the voxels that the region3 is in, then it checks if the hitbox is overlapping with those voxels

Just doing some simple comparison math should be easier but more annoying maybe

Doesn’t Region3:ExpandToGrid() deal with that?

That just expands the region 3 to match the voxels but it still has to figure out which hitboxes are overlapping with it

1 Like

Okay, I suppose that’s enough info for now. I’ll go with manual checks.