When trying to use WorldRoot:Raycast()
on Terrain, it returns nil. It works fine on a regular BasePart, the issue is only isolated to Terrain. I only discovered this issue today, and can’t say how long this has existed.
Code I used for testing (run in command bar):
local params = RaycastParams.new()
local Character = game.Players.LocalPlayer.Character
params.FilterDescendantsInstances={workspace.DevBuckette, workspace.CurrentCamera}
params.FilterType = Enum.RaycastFilterType.Blacklist
local Origin = Character.HumanoidRootPart.Position
local Direction = Origin - Vector3.new(0,30,0)
local result = workspace:Raycast(Origin, Direction, params)
print(result)
Simply walk onto a patch of terrain while in Test mode, and run the code.
Output when the code is run while standing on Terrain:
Output when the code is run while standing on a BasePart