Raycast not functioning

ScreenPointToRay returns a unit-length Ray (only one stud in length). This means that your raycast will only be one stud in length, since you are directly using ray.Direction. You should multiply ray.Direction by the distance in studs that you want to test along (e.g. 100).

There is a code sample on the DevHub which should help (the first one, before the “Parameters” section).

1 Like