Any actually GOOD tutorials for raycasting?

I’m not too good at scripting, and one thing that I’ve been wanting to learn for a while now is how to do raycasting? I’ve searched up many tutorials on youtube for it, looked on the dev hub, and they’ve all either been about making a gun, or it’s just too complicated. Are there any actually good tutorials for raycasting?

Personally never used raycasting, but from my understanding…

WorldRoot:Raycast(start,distance,options):

Start is a Vector3 value of where it shall start.
Distance is a Vector3 value of how far the raycast shall “look”, so to speak.
Options, is a bit complicated, best way to look for them is in the RaycastParams | Documentation - Roblox Creator Hub page on the dev hub.

WorldRoot I believe is a property of Workspace/Workspace itself. Not entirely sure

Here is a good article I have found on the developer hub!
Guide

I also had found a good video that explains how they work pretty good!
Video

1 Like

Raycasting is not really that hard actually, you just give a position and a direction, you can use optional arguments too.

local rayParams = RaycastParams.new()
workspace:Raycast(origin, direction * distance, rayParams)

origin is the start position of the ray.
direction is the unit direction.
distance is the length of the raycast.
rayParams are the options for the ray, you can use a blacklist or a whitelist to specify objects that should be ignored/whitelisted in the raycast.

2 Likes