Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[SOLVED] Why is workspace:Raycast() completely ignoring unions?

Asked by 1 year ago
Edited 1 year ago

I am working on a weather system that works great; for everything except union operations. For some reason, the ray passes straight through all the unions, despite setting the collision fidelity to Precise, and all best efforts to fix any collision problems that may be caused by it.

(One of the unions is a block part that was unioned, and has 12 triangles, so it is not complexity)

Each emitter part is casting a ray directly below it with the following code:

local ignore = {}
for _,player in game.Players:GetChildren() do
    if player.Character then
        ignore[#ignore+1] = player.Character
    end
end

local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = ignore
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
raycastParams.IgnoreWater = false

local hit2 = workspace:Raycast(emitter.Position, Vector3.new(0,-5000,0), raycastParams)
if hit2 ~= nil then
    if hit2.Instance.Name == "Union" then
        print(hit2.Position)
    end
end
if hit2 ~= nil and hit2.Position.Y > -500 then
    local hit_pos = hit2.Position
    print(hit_pos, hit2.Instance)
end

The code returns the hit position and instance of the baseplate below the union, and completely ignores the union.

Relevant game if you want to see it in use: https://www.roblox.com/games/11262775141/Dynamic-Rain

Link to the model with the entire code found in the game: https://www.roblox.com/library/11461945331/Rain-Module

1 answer

Log in to vote
0
Answered by 1 year ago

Found the problem after hours. Roblox should have this in their documentation, but raycasts do not detect unions past 2000 studs, despite it detecting parts and terrain up to 5000

Thus, as I was placing my rays at y=5000 to detect as much of the map as the raycast would allow, no unions were detected at all.

TLDR don't try and raycast over 2000 studs if you want to detect unions.

Ad

Answer this question