0 votes


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 getcollider() returns null. If I log the castto 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 getdirectspace_state() ?

Any ideas? Thanks in advance!

in Engine by (24 points)
edited by

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?

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.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.