I am writing a code that checks for parts that are roughly in a certain area every heartbeat.
The questtion is which is more performant?
GetPartBoundsInBox or GetPartBoundsInRadius.
I might do a benchmark in the future, but for now all I need is an educated guess
Thanks in advace.
GetPartBoundsInBox
is based on the radius of a cube/prism. GetPartBoundsInRadius
is spherical.
Excuse my horrible drawing.
There is also a third function, called GetPartsInPart
. If you wanted to do this simpler without CFrame and stuff, you could just make an invisible part and check. But either 3 work depending on your situation.
Thx, but I know what I want to do and what those funtions do. I want to know which function performes better. Would GetPartBoundsInRadius
performe worse as it uses Vector3.Magnitude or would it performe better as it doenst have the check all sides of the box like GetPartBoundsInBox
does?
They would perform exactly the same. The only difference is the type of radius it is. If you were to use the same parameters for both of those, the InBox
function will include more parts due to it being bigger.