RayCast 3D not returning correct Coordinates

Godot Version

V 4.2.2

While colliding with Girdmap items raycast 3D not returning correct coordinates.
and it seems that the raycast only collides with griditems placed using the editor and not with items generated using code