Hey, Im having a problem with raycasting. Im using ray_intersect and it isn't detecting the ceiling above the player. Whenever I jump it points to the top where there's nothing. They ray Im casting is the blue ine and the green line and red dot is where the result.position is of the cast. No idea what Im doing wrong. This is my code
var spaceState = get_world_2d().direct_space_state
result = spaceState.intersect_ray(global_position, Vector2(global_position.x,global_position.y-50), [self], collision_mask)
if result:
hitPos = result.position```
```func _draw():
if result:
draw_circle((hitPos-global_position), 5, Color(1.0,0,0))
draw_line(Vector2(0,0), (hitPos-global_position), Color(0,1.0,0))
draw_line(Vector2(0,0), Vector2(0,-50), Color(0,0,1.0))```
Here is a gif of the situation. https://cdn.discordapp.com/attachments/342056330523049988/470673074572886017/RayProblem.gif