I want to check if a new_position is available, if this position is available I want the node to move there.
I'm using an area2D with a collisionShape that gets moved to the desired new_positon. It needs to check if the spot is available, and then move there if it is available.
Here is a example of how it works
block = true
block = false
shape.position = new_position
if block == false:
self.position = new_postion
The problem is that the collisionshape only updates after the code is run completely, causing a delay, making it available to move trough walls.
I tried using Raycast first, which has the following function:
This fixed the delay, but the issue with a Raycast is that it checks in a line, and not in a point. So maybe a similar function for signals could work.
I'm looking for a way to check if a collision occurs at that point. But i'm out of ideas, and google searches. I hope one of you has an idea how to fix this.