Change 3D Object on one Image tracker with button

0 votes
asked Dec 31, 2019 by freshindigo (130 points)
Hi!

Right now im trying to change 3d objects on one image target with a press of a button. I tried multiple solutions but nothing worked. Can someone give a hand? I will be very grateful.

One of solutions that I tried in ImageTrackerController but it didnt work.

  public void OnChangeTarget()
    {
        string target_path = null;
        target_path = this.TargetPath;
        this.TargetPath = TargetPath2;
        this.TargetPath2 = target_path;
        LoadImageTarget();

    }

1 Answer

+1 vote
answered Jan 1, 2020 by kenn (18,790 points)
Do you want to change the virtual object displayed on the image? If so, you just need to remove all objects under the target GameObject, then put a new object under the target GameObject.

Or do you want to load another target into the tracker? Then it is better to take a look at the ImageTracking_Targets sample for how to load and unload targets.
commented Jan 1, 2020 by freshindigo (130 points)
Thank you for your answer. Appreciate it!

I will clarify some points on my question. The main idea is to have one ImageTarget, so when a camera on the phone sees the picture, the 3D object will appear and then with a press of a button I can switch the shown 3D object to another 3D object, so as ImageTarget remains the same. I don't understand how to programme the button so that it can make this transition.
commented Jan 5, 2020 by kenn (18,790 points)
It is not a difficult task if you are familiar with Unity. Try run in the Unity Editor, when the image is tracked, the 3d object will show up. Delete it using the DELETE button on the keyboard, and right click on the target and create a new object under the same node. That is the basic operation, when you understand how it works, translate it into script will be easy.
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...