I am not able to test the code (I'm not at my PC). Just have some free time and I'm studying theory. In this case, I beg to treat with understanding, I do not know English. Reading the documentation helps me Gogle. However, the result of his translation is very difficult to perceive.
In GDScript I'm a beginner, maybe that's why I don't understand how this code is consistent with the method:
result = space_state.intersect_ray
I correctly understand what "var from" this is what I in the first post as noted Vector3(x1,y1,z1)? And "var to" Vector3(x2,y2,z2)?
Can I limit the length of the RayCast (to make it portion)?