Add touch event on object on ImageTracking_CloudRecognition

0 votes
asked Sep 14, 2020 by markup (240 points)

Hello,

I'm trying Unity Sample of ImageTracking_CloudRecognition. Cloud Recognition itself works well, and now I want to add touch event on Object on the target image. From a past question article;

https://answers.easyar.com/932/detect-click-on-a-object

I know it's possible to add touch event on object, but I cannot find on which GameObject in the Hierarchy I should add touch event script. Could you give me advice?

Thanks.

http://up-img.net/img.php?mode=jpg&id=9307

http://up-img.net/img.php?mode=png&id=9308

1 Answer

0 votes
answered Sep 15, 2020 by kenn (18,750 points)
There is only one empty (no meshes) node for the target (which has the ImageTargetController component). You can put the touch event there but you have to make the object clickable by yourself. It is also possible to put the event on some other object you create when it can follow the movement.
commented Sep 16, 2020 by markup (240 points)
Thank you for your advice but
>There is only one empty (no meshes) node for the target (which has the ImageTargetController component).

Where is that? On which GameObject there is the only one empty node ? Could you advice me concretely?

Thanks.
commented Sep 16, 2020 by kenn (18,750 points)
Try look at the scene graph when you recognized some image when the Unity is playing, you will find it.
commented Sep 16, 2020 by markup (240 points)
I'm sorry but I cannot understand your advice.....

>Try look at the scene graph
 What do you mean?

>when you recognized some image when the Unity is playing,
Do you mean check by console log? I'm trying this sample by smartphone and cannot see console log when playing.

Or, is there any description about your advice in the document?
http://help.easyar.com/EasyAR%20Sense%20Unity%20Plugin/Samples/ObjectSensing/ImageTracking_CloudRecognition.html
commented Sep 16, 2020 by kenn (18,750 points)
Technically, it is a problem of Unity when you want to find a specific gameobject, it has nothing to do with EasyAR, so apologize if I skip some Unity basis.
You need to find a node with a ImageTargetController component on it, which is created in the sample code.
I see your screenshot of hierarchy view and the game view. Try look at the hierarchy view when the game view shows what you capture. You can also find it using scripts if you prefer. Let me stop here at the moment, Unity is huge.
commented Sep 16, 2020 by markup (240 points)
Hello Sir, my question is quite simple. Where is the object? As for ImageTracking_Targets sample the cube, the object I can find in Hierarchy clearly. But in the CloudRecognition sample I cannot find the object. After I can find that it's quite easy to add event script.
https://d.kuku.lu/2815526679
commented Sep 16, 2020 by kenn (18,750 points)
Well, let's forget about finding object in the scene and restart from a different point. The object you are looking for is the sample code (possiblely CloudRecognizerSample.cs). Search for "new GameObject".
commented Sep 16, 2020 by markup (240 points)
No...... The Object what I mean is the "EasyAR" cube ( I don't know its formal name) on the Target image.  
https://d.kuku.lu/a52312da8a
I want to add script on this EasyAR cube now.
Quite easy to do that in the ImageTracking_Targets sample as cube object is clear in Hierarchy.  But it's not visible in the ImageTracking_CloudRecognition sample.  So my question is "Where is the "EasyAR"object in the ImageTracking_CloudRecognition sample?"
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...