i have npcs which i want to be able to detect projectiles and know what direction the projectile is coming in.
so i set up 4 raycast on the npcs. (front,back,right,left). all the raycast are fine with detecting when a player moves in front of them. but when it comes to projectiles it doesnt detect it at all.
is the anything else about raycast that i dont know and isnt pointed out on the wiki(no surprise there)
do you know how i cant get them to detect the projectile. or any other detection method i can use. here it my code
local c = NPC.Character
local r = c.HumanoidRootPart
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {c}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local HB = game:GetService("RunService").Heartbeat:Connect(function(dt)
local FrontRay = workspace:Raycast(r.Position, r.CFrame.LookVector * 50, raycastParams)
local BackRay = workspace:Raycast(r.Position, -r.CFrame.LookVector * 50, raycastParams)
local RightRay = workspace:Raycast(r.Position, r.CFrame.RightVector * 50, raycastParams)
local leftRay = workspace:Raycast(r.Position, -r.CFrame.RightVector * 50, raycastParams)
if FrontRay then
print("Projtile Infront")
Soul.Dashing(NPC,4)
end
if BackRay then
print("Projectile Behind")
Soul.Dashing(NPC,3)
end
end)