With my current skills, I can only create objects that rays ignore prior to the ray being created, but now I realise there's new objects being added to the game which parents are specific and a ray must ignore; however I am struggling to achieve this has a ray ignore lists must be defined prior to a ray being created. A mundane solution could be to create a second ray, however this would mean I will have to change a significant amount of code which could cause other problems and may affect performance. Another thing I would also like to know is if the following code:
for i = 10, 50 do --casting a ray function end
Without any waits(), will this cause performance issues, I am attempting to create rays to see if the surrounding parts has anything between the ray origin and the part itself.
Hello Marmalados! Yes, there is a way to ignore parts and as a matter a fact multiple parts when your raycasting. Here is an example
local IgnoreList = {} --insert part instances that you want to be ignored into this table function MakeRay(StartPos, EndPos) local ray = Ray.new(StartPos, EndPos) local hit, V3pos = workspace:FindPartOnRayWithIgnoreList(ray, IgnoreList) end
What is shown above, is raycasting with ignored parts! We start by making an array of instances that will be ignored, then when the function is ran, we make our ray. From there, we can determine the rays final part with the list of instances we told it to ignore! With further questions/comments/concerns, please feel free to reply! ~mc3334