I am using the new rays (workspace:raycast())

I want to find the Closest point of something to the ray like Ray:ClosestPoint().

BUT… only the deprecated raycast has that built-in function. I want to use the new raycast. How do I do it?

That is semi-incorrect, what is deprecated is the FindPartOnRay function which is right.

However the actual ray object is not deprecated as seen here. It’s just a data type with a neat built in function.

So you just go ahead make the ray then use the closest point function.

```
workspace:raycast(origin, direction)
local ray = Ray.new(origin, direction.Unit)--make sure to .Unit for closest point to work
```

Or you can use the mathematical method here: