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
You'd have to make rayDirection be based off the origin like so:
local rayOrigin = model.Detector.Position local rayDirection = Vector3.new(1,-1,1)*mode.Detector.Position