Alright so i recently decided to take scripting seriously and started learning it but i have a problem with raycasts, i just cant figure them out. The raycast is ignoring everything and only detects the model itself. I want it to only detect the parts inside a folder in the workspace but its just ignoring that.
Include (previously named Whitelist) only queries filtered instances, and Exclude (formerly Blacklist) ignores them in favour of everything else that can be evaluated. Your current setup only detects the baseplate.
Well the problem is its not detecting the obstacles (which are located in a folder inside the workspace) but it does detect its own model when its set to Include. But when i change it to Exclude it just ignores everything. I dont know what the issue is as its also never detecting the baseplate which is simply just in the workspace.
Is the issue just that it cant detect anything in folders? or am i refrencing the parts in the folder wrong?
If you want the raycast to focus only on the obstacles in the folder (and nothing else), you should set the filter type to include and have the whole folder in FilterDescendantsInstances, exactly as in the example above.
If you wish to only ignore the model and maybe some other specific parts, then Exclude will exclude from evaluation any instances that are in FilterDescendantsInstances.
Direction is normalized (unit), so it has a length of 1 (line 16). The ray is not infinite, it’s as long as the directional vector. You can just leave the vector difference as it is, and the length will be the magnitude between the origin and the nearest enemy.