'How can I detect a click/tap on a tracked image with Unity's ARCore?

I just got into ARCore and want something to happen when I click on one of the images tracked (defined in the reference image library of my ARTrackedImageManager).

I know how to detect a click (or a tap on the phone's screen) but I don't know how to detect if it's anywhere on the image. Where should I look for that ?

I'm thinking that maybe I gotta find a way to detect the plane of the image, then detect if the click is happening inside, not sure that's the solution. I'm also not sure if ARCore already does that or if I have to code it myself.

Any idea to help me ?

I haven't started a script yet, I know how to code everything for my little project but the click detection.



Solution 1:[1]

How clear is it from the question, do you need to find the location of tapping on the screen? That is, find the X and Y coordinates? If this is the case, then you can use the OnMouseDown() method to track the position of the click on the object that has a collision.

private void OnMouseDown()
 {
    Vector2 XYCoordinates = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
 }

Attach this script to the collision you want to track.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ?????? ??????