This is already possible, you simply need to put the parts outside of the workspace inside of a WorldModel, and you will be able to raycast and region query against them on the WorldModel the same way you would against parts in the Workspace by calling those functions on the Workspace.
Returning a mixture of parts from different physical spaces doesn’t make a ton of sense, but creating a separate physical space for parts to exist in via a WorldModel already works.
Are there any plans to have this support terrain? This would save me a lot of time programming and probably resources too if done because my solution now is to use raycasting to get terrain.
The dude wrote over several pages of benchmarks and spent considerable time testing the performance of the new APIs, which many people wanted answers about, and for you to accuse him of faking this with no reasonable motive is very toxic.
a question, how get touching parts work? it loop on all parts from workspace and make a math?cause people said me get touching parts be slower if have a lot of parts on workspace.
local Origin = CFrame.new(Vector3.new(-840, 0, -820))
local Size = Vector3.new(1000, 1000, 1000)
local Params = OverlapParams.new()
Params.FilterDescendantsInstances = {workspace.Trees["Big Bush"]} --> 'Big Bush' only contains two parts inside.
Params.FilterType = Enum.RaycastFilterType.Whitelist
local Time1 = os.clock()
workspace:GetPartBoundsInBox(Origin, Size, Params)
print(os.clock() - Time1) --> 0.2
In my game it takes 0.2 seconds for this function to run cuz I have a lot of BaseParts, but I have a question. I expect giving a White List would make the process faster since the engine should check only the parts inside the White List. I ran the function without the whitelist:
local Origin = CFrame.new(Vector3.new(-840, 0, -820))
local Size = Vector3.new(1000, 1000, 1000)
local Params = OverlapParams.new()
local Time1 = os.clock()
workspace:GetPartBoundsInBox(Origin, Size, Params)
print(os.clock() - Time1) --> 0.2
My guesses are that the engine scans the workspace completely and checks if they are in the white list. I don’t like it. Could you guys make it so it scans only the parts inside the white list please? I really need it for my game items. I want to get the nearest ones out of all of them. I would love to tag all my items and pass the table with all items to that function as white list. (Faster than checking for magnitude yourself).
As a long-time fan of :GetTouchingParts, but constantly frustrated at it’s terrible limitations, I’ve started using this wide-spread among my games within the past few days, and I’ve gotta say - Wow, not only is this comprehensive & useful, but it’s super intuitive. Just about any setup using Region3 or GetTouchingParts can be so eloquently converted to this new system, saving a few lines of code in the process, usually.
Top notch update, solving one of my oldest problems in Roblox development.
Can’t OverlapParams and RaycastParams be combined into one data type like QueryParams? I find it extremely inconvenient to have to use different data types as they are essentially identical.
Code sample:
local o_params=OverlapParams.new()
o_params.FilterType=Enum.RaycastFilterType.Blacklist
--Both use Enum.RaycastFilterType further proving they
--are identical data types
o_params.FilterDescendantsInstances={self.char,self.cam}
o_params.MaxParts=1
local r_params=RaycastParams.new()
r_params.FilterType=Enum.RaycastFilterType.Blacklist
r_params.FilterDescendantsInstances={self.char,self.cam}
Did WorldRoot:GetPartsInPart() change recently? I’m pretty sure it used to return Terrain if the part overlapped with terrain but I just noticed it does not return Terrain anymore. I’m 90% sure this used to return terrain.