Hi, I'm trying to have items be detected when I tap on them in AR. My input script is currently like this:
func _input(event):
if event is InputEventScreenTouch:
_check_for_hits(event.position)
func _check_for_hits(position: Vector2) -> void:
if not has_session_started: return
var camera := $ARVROrigin/ARVRCamera as Camera
var space = camera.get_world().space
var state = PhysicsServer.space_get_direct_state(space)
var from = camera.project_ray_origin(position)
var direction = camera.project_ray_normal(position)
var result = state.intersect_ray(from, from + direction * INF)
print(str(result.keys) + " | " + str(result.values) if result.size() > 0 else "Empty")
However, when testing on mobile, the results return empty.