I have a part that's in a moving model and a raycast that detects the bottom. Sometimes it just detects random stuff, like the parts ontop or the parts on the side even tho i set it to detect stuff from the bottom, and when the part is in another part it detects literally nothing. How do I go around fixing this?
local rayOrigin = model.Detector.Position
local rayDirection = Vector3.new(0,-1,0)
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {model.Detector}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResult = game.Workspace:Raycast(rayOrigin, rayDirection, raycastParams)
if raycastResult then
local hitPart = raycastResult.Instance
print("something")
else if not raycastResult then
print("nothing")
end
end

1 comment
I don't 100% understand the question, but make sure you know the difference between blacklist and whitelist. With a blacklist (what you are using) anything in the FilterDescendantsInstances table will be ignored by the raycast. With a whitelist, ONLY what is in the FilterDescendantsInstances table will be detected by the raycast. In your case, model.Detector is being ignored, and everything else i