Isn't Raycast2d "cast_to" vector affected by parent node transformation?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By immccc
:warning: Old Version Published before Godot 3 was released.

Hi,

The situation is that I have an sprite with two perpendicular Raycast2Ds that at, a certain point, I’d like to check whether the sprite is at the side of one area.

The result is that get-collision-point() is always 0 and get_collider() returns null. If I log the cast_to Vector, it always prints the same value ( (0, 50) ) .

My guess is that the cast-to vector is not affected by parent node transformations. Eitherway, I am not finding to find a solution where the raycast detects the area (Node2D that I swapped to Area2D in order to check if, maybe, the problem is the kind of object). Am I right? Should I get rid of Raycast2D node and use get_direct_space_state() ?

Any ideas? Thanks in advance!

The cast_to value is local.

First check is_colliding.

Your ray is enabled and collision mask includes areas too?

What do you see when you enable the collision shapes?

eons | 2017-01-01 20:55

Thanks for your response. I forgot to mention that yes, the rays are the enabled flags as true, and the layer mask of them are the same as the objects to collide, and the type mask includes all kind of collisionable types.

The areas to collide are just squared “virtual” Area2D nodes, in particular parking slots where a car calculates how it has to be placed before starting the reverse in order to park.

immccc | 2017-01-02 14:40