Maximum raycast distance?

Is there a maximum raycast distance? Will longer raycasts (about 30,000-100,000 studs) impact game performance?

3 Likes

yes, there’s a maximium, but you can raycast multiple times at the last one, but pretty sure it can lag though, why you need such bigs raycast

1 Like

I’m creating a rangefinder for a naval game, the map is about 20480 studs^2 so the distances are very large.

1 Like

for rangefinding in between the ships i’d reccomend simply doing:
(PlayerPos-TargetPos).Magnitude
For rangefinding the land it’s going to get slighty painful, as you’ll have to connect multiple raycasts.

1 Like

Also, what is the maximum raycast distance? Can I get a number?

2 Likes

Now, I reckon that it is probably just going to crash so it could be infinite.

An extremely large raycast distance is an edge case so it wouldn’t even be thought of because no one is going to need such long rays. If you find a situation where you think of using really long rays, you might be using raycasts incorrectly or math is recommended to be used instead.

1 Like

The maximum raycast distance is 5000 studs.

9 Likes