Godot Version
4.6
Question
a raycast is not colliding with a tilemap even though it is going right through. the tilemap is on the same collision mask as the raycast. it managed to collide before(i have actually posted a seperate topic about this exact same raycast and it is an entirely seperate issue)
here is a screenshot of the scene running
here is a screenshot of the scene tree and inspector
and text version of the code
extends Area2D
@onready var collision_shape_2d: CollisionShape2D = $CollisionShape2D
@onready var ray_cast_2d: RayCast2D = $RayCast2D
@export var maximumLength = 5000
func calculate_distance(vector1, vector2):
var distanceVector = abs(vector2 - vector1)
return sqrt(distanceVector.x ** 2 + distanceVector.y ** 2)
Called when the node enters the scene tree for the first time.
func _ready() → void:
ray_cast_2d.target_position = Vector2(50000,0)
print(ray_cast_2d.position, ray_cast_2d.global_position, ray_cast_2d.target_position)
ray_cast_2d.force_raycast_update()
ray_cast_2d.add_exception(self)
var position = ray_cast_2d.get_collision_point()
print(ray_cast_2d.is_colliding())
print(ray_cast_2d.get_collider())
print(ray_cast_2d)
print(ray_cast_2d.collide_with_bodies)
print(ray_cast_2d.enabled)
print(position)
collision_shape_2d.shape.b = position
Called every frame. ‘delta’ is the elapsed time since the previous frame.
func _process(delta: float) → void:
pass
game files if really desperate:
sorry to leave you with the file , i know its a bad thing to do but im not gonna available cause im posting this right before sleeping and am only going to be able to answer questions at most after 10 minutes or so

