Ray Length, does it exist?

I didn’t find anything on it, but is it possible to find the length of a ray?

1 Like

You can get the distance between the Origin and the Direction.
Something like this:

local Direction = YourRay.Direction
local Origin = YourRay.Origin

local Length = (Direction - Origin).Magnitude
print(Length)
1 Like

I would try this

alright, i used the ray’s starting position, and the hit position to calculate the final length

1 Like

This is wrong, .Direction does not return the destination.

1 Like

Yeah, I accidentally did that. After you cast the ray, you can get the position of the hit. Origin - HitPos would work instead.

2 Likes