So, I was in the process of translating my GDScript-Code to C# in the hope of some extra fps and I encountered a
small issue. I’ve searched the world wide interwebs but didn’t find an answer.

var space_state = get_world().direct_space_state
var result = space_state.intersect_ray(Vector3(0,10,0),Vector3(0,0,0))
if result:

You have the ambition to know where your ground is, our your enemy or you want to know how far the next obstacle is. In GDscript, well documented, you get the position by


It isn’t that easy in C#. The syntax matches what is written on the official site.

PhysicsDirectSpaceState space_state = GetWorld().DirectSpaceState;
Godot.Collections.Dictionary result = space_state.IntersectRay(new Vector3(0, 10, 0), new Vector3(0, 0, 0));

You can also determine if the result is null. But how to get the information, like the position of intersection?
I don’t know if I overread this, but I didn’t found a tutorial/doc for this.

If you want to get the ,e.g. position you have to cast and to the class you want and know wich key.