IntersectRay don't give any results in 2D game

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Moreus

Hello,
I trying use Ray-casting with script supporting on Godot Engine 4.0 documentation in English but i get no any results.
My code:

I added DrawLine to see raycast.
My scene:

My character while game is running:

in console I don’t get any results when i try collide with tile wall or tree.
Anybody know why this could not work?

:bust_in_silhouette: Reply From: Moreus

easy fix and nobody find out…
use global coordinates, not local to node
var query = PhysicsRayQueryParameters2D.Create(GlobalPosition, GlobalPosition + Vector2.Up * 10);