3 new properties for Workspace dealing with raycasts and regions

Okay, I’m sure that anybody who has written an FPS with large maps has had to write a function called “raycast” which performs as many FindPartOnRays as needed to traverse the entire length of any arbitrary ray. And I’m sure a few of you have written a custom “FindPartsInRegion3” which creates as many region3s as needed to unlock both the returned part count and the volume cap.

We can’t just uncap these values because some peoples games would crash when giving bad inputs to the raycast methods and region3 methods, right? But we could make new properties which allow us to set this cap. The could be hidden too, as to not pollute the properties bar.

Workspace.MaxRayLength = 1000
Workspace.MaxRegionVolume = 100000
Workspace.MaxRegionParts = 100
19 Likes

Why do they even have a cap anyway? I would just set all of them to math.huge.

Support.
Let’s be honest–100, 1000, and 100000 are just random round numbers. They’re obviously not technical limitations.

Hidden properties would feel like API bloat imo. Just raise the caps.

That’s unreasonable.
The caps should all be math.huge, but it will break some games. So you have to have some sort of way to select the caps yourself, or disable them.

Just FYI, the ray length limit is currently 5000 but it’s still documented on the wiki as 1000.

wat. A ray that long isn’t useful or even technically possible because positions are stored as floats.

I was getting across the point that there shouldn’t have been caps in the first place, but, as I said in the OP,

Also, I didn’t know that it had been increased to 5000. Thanks for letting me know.

Will update, thanks.