how to check if a point is inside an area

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

Hello everyone, i need some help with this, i couldnt find any examples on how to do it in godot 3.0.
what i am trying to do is check if a point is inside an area2d
ive been trying to get the direct space state of the scene i am in like this:

var space=World2D.direct_space_state
var results = space.intersect_point(point, 32, [], 2147483647)

but it throws an error: invalid get index ‘direct_space_state’ on GDScriptNativeClass

thx in advance.

:bust_in_silhouette: Reply From: kidscancode

To get the space state, you need to retrieve it with the proper method from the World2D, not call its class name:

var space_state = get_world_2d().direct_space_state