0 votes

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():
    var collisionCheck = physicsState.intersect_ray(self.position+Vector2(8,0),tile.position)
    if collisionCheck:
        print("collided with: " + collisionCheck.collider.name)

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?

asked Oct 3, 2019 in Engine by xofox (90 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.