I need to get the closest point on a ray from another point. Basically its the Ray:GetClosestPoint() function but Im not using the legacy ray. I need a simple and easy to understand formula. I dont understand all the math on google beacuse I havnt even learnt it in school.
I am using it for lag compensation for my raycast gun/
nevermind guys the formula i have is already working
here it is for those that need it:
local function GetRayClosestPoint(Origin, Direction, Point)
local A, B = (Origin - Point), Direction.Unit
local V = A - A:Dot(B) * B.Unit
return Point + V
end