I have a gridmap with voxels and they have static bodies and colliders, I'm trying to cast a intersect array to get the instance of the cube, and to later put something in the gridmap relative to the block, currently stuck at getting the thing clicked on this is my code:
public override void _PhysicsProcess(double delta)
{
Vector2 mousePosition = GetViewport().GetMousePosition();
Camera3D camera = GetViewport().GetCamera3D();
Vector3 rayFrom = camera.ProjectRayOrigin(mousePosition);
Vector3 rayTo = rayFrom + camera.ProjectRayNormal(mousePosition) * 1000;
PhysicsDirectSpaceState3D spaceState = GetWorld3D().DirectSpaceState;
Godot.Collections.Dictionary result = spaceState.IntersectRay(PhysicsRayQueryParameters3D.Create(rayFrom, rayTo));
if (result.Count > 0)
{
//No clue what to do here
}
}