I tried getting the intersect_point() to work in a 2d world, but i cant make it get me any results. I'm using it in a node2d player scene and am checking for node2d scenes with static or rigid bodys attatched to. I couldnt find any examples how to use it, so i'm asking here.
-
I tried to make it work on the (0.0) coordinate first, but coudln't make it return anything.
What am i doing wrong?
-
Also how to check a position relative to my player scene?
-
Array intersect_point ( Vector2 point, int max_results=32, Array exclude=Array(), int layer_mask=2147483647, int type_mask=15 )
func _fixed_process(delta):
var space_state = get_world().get_direct_space_state(self.get_world().get_space())
var result = space_state.intersect_point( Vector2(0,0))
if (not result.empty()):
print("Hit at point: ",result.position)