Godot Version
4.3
Question
In my game, the character moves between a limited set of navigation points that form an AStar2D
graph. I my scene’s ready()
function, I run a Script that figures out which points should be connected by using a RayCast2D
.
As you can see in the screenshots below, my character starts in the bottom left hand corner and wants to move to the next navigation point (white square) to the right. The raycast is red, which I would think indicates that there is a collision, however the is_colliding()
function returned false during the creation of the scene, so the character moves through the building.
Here’s what I already tried:
- The
TileMapLayer
and the raycast both have the same collison layer/mask - The
TileMapLayer
’s collision is enabled - I’m calling
force_update_transform()
andforce_raycast_update()
- The raycast is set to collide with bodies, but not areas
- When I set it to collide with bodies, it correctly detects collisions with the other navigation points
- When I set it to not collide with areas, all arrows in the debug view are blue, and the player behaves the same
- I added another check to my character to see if it works during physics processing, and it still fails to detect the collision