Problem
As a Roblox developer, it is currently too hard to properly detect players within a cylinder.
Use Cases
The following use cases are presented.
Use Case 1
Background
The first use case involves a game type known as King of the Hill where players fight over a specific area that checks which players are within that area. If all the players are from the same team, then that team gains a point.
Use Case
The issue stems from the fact that if the area is circular, then one has to use GetPartsBoundInRadius()
which is a sphere, not a disk. The disadvantage of this is at the edges of the area. If the player jumps, they can jump out of the detection even though they are within the area. Furthermore, parts that may be beneath the detection area are included in the resulting parts list which will degrade performance.
Use Case 2
Background
The second use case involves the player jumping through vertical hoop.
Use Case
Since GetPartsBoundInRadius
detects objects within a sphere, and depending on how big the hoop is, and the player position, the player will be detected before they even enter the hoop. In fact, they can be detected as far out from the hoop and the radius of the hoop. If they miss the hoop, they will still be detected as entering the hoop even though they missed it. As such, depending on the game in question, this can be detrimental to game mechanics.
Additional Information
Reasons to not use GetPartsBoundInBox()
The reason why GetPartsBoundInBox cannot be used is the same reason why you cannot fit a square peg in a round hole: It just simply will not fit. If the detection area is a disk, then what will happen is either part of the disk is excluded from the detection or parts of the area outside the disk are included in the detection in error.
Reasons to not use GetPartsInPart()
Although, it is possible to have a disk/cylinder part that encompasses the detection area, the disadvantages of this are as follows:
- An extra part is needed for the detection to work.
- As per the Roblox documentation (shown below), the performance of this method isn’t exactly fast, which may be needed in a game that uses the King of the Hill game play where the detection needs to happen many times a second. This can cause the server to become overloaded if many players are within the detection zone.
Conclusion
If Roblox is able to address this issue, it would improve my development experience because there would be a specific method to call when detecting parts within a disk region which will add to the performance of a game vs. using GetPartsBoundInBox()
which will not fit the region and GetParts InPart()
which isn’t exactly performant.