RayCast not detecting Gridmap collisions

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

I have a Gridmap with a Cube mesh that looks like this:

enter image description here

Additionally, I have a separate static body, with a CSGBox and CollisionShape in the scene:

enter image description here

When I send a ray from the mouse position relative to the camera to the world space, I get the raycast hit information when I click on the static body, but whenever I click on my Cubes on the GridMap, I get nothing back.

enter image description here

This is the code I use to throw rays:

using Godot;
using System;

public class CameraController : Camera
{
    private const float MOUSE_RAY_LENGTH = 100;
    private Godot.Collections.Array _rayExclusions;

    public override void _Ready()
    {
        _rayExclusions = new Godot.Collections.Array(this);
    }

    public override void _Input(InputEvent @event)
    {
        if (@event is InputEventMouseButton eventMouseButton && eventMouseButton.Pressed && eventMouseButton.ButtonIndex == 1)
        {
            Vector3 from = this.ProjectRayOrigin(eventMouseButton.Position);
            Vector3 to = from + this.ProjectRayNormal(eventMouseButton.Position) * MOUSE_RAY_LENGTH;
            
            GD.Print(GetWorld().DirectSpaceState.IntersectRay(from, to, _rayExclusions));
        }
    }
}

How do I properly detect Gridmap raycast collisions?