using Godot;

public partial class OverlapTester : Node3D
{

    public override void _Ready()
    {
        GD.Print("Starting overlapper tester thingy");
    }

    public override void _Process(double delta)
    {
        var query = new PhysicsShapeQueryParameters3D();
        var sphere = new SphereShape3D();
        sphere.Radius = 0.1f;
        query.Shape = sphere;
        query.CollideWithBodies = true;
        query.CollideWithAreas = false;
        query.Transform = GlobalTransform;
        var overlaps = GetWorld3D().DirectSpaceState.IntersectShape(query);
        foreach (var fuckingcollider in overlaps)
        {
          try {
            var collider = (RigidBody3D)fuckingcollider["collider"];
            GD.Print(collider.Mass);
          } catch (System.InvalidCastException) {
            // dont care
          }
        }
    }
}
