I'm trying to cast a ray from the camera into 3D space, and I followed the examples from the docs, but it's not working for some reason. Shouldn't this work?
mouse_pos = get_viewport().get_mouse_pos()
ray_query_from = camera.project_ray_origin(mouse_pos)
ray_query_to = ray_query_from + camera.project_ray_normal(mouse_pos) * 1000
var space_state = get_world().get_direct_space_state()
var result = space_state.intersect_ray(ray_query_from, ray_query_to, [self])
print("result: ", result) #<-------- always comes out empty
I have several Areas with CollisionShapes set with BoxShapes that should be being hit but aren't. result dict is always empty.