What is wrong with my usage of get_overlapping_bodies?

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

this is my script:

func sightCheck(light):
visionShape.radius = light*16 #16 is the TileMap cell size
var physicsState = get_world_2d().direct_space_state
for tile in visionCollisionBody.get_overlapping_bodies():
	print(tile.position)
	print(tile.name)
	var collisionCheck = physicsState.intersect_ray(self.position+Vector2(8,0),tile.position)
	if collisionCheck:
		print("collided with: " + collisionCheck.collider.name)
		pass
	else:
		fog.set_cellv(tile.position,-1)

What it should be doing is seeing if it can draw an uninterrupted line to the tile in the area and if it can then remove the fog from the fog tilemap. my first issue is that it only prints as seeing the tile at 0,0. I know it’s not the player because it says it has collided with 0,0. It also doesn’t change which tile is being printed based on the position of the player. Any chance anyone knows what’s wrong here?