How to Create an Infinity Long Ray Cast

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By suyen729

In Unity, if we didn’t set RayCast2D Length, then it will be infinity long, but in GODOT we have to set position cast to, can we make RayCast infinity?

:bust_in_silhouette: Reply From: Tim Martin

It looks like unity is storing three parameters: origin (vec), direction (vec), distance (float).

Godot is instead storing only two parameters origin (vec) and cast_to (vec). With the distance being a derived property.

If you want the unity-style behavior your could use a script to take a direction unit vector, scale it up by some large number (1e6 should do it) and set that as cast_to.