Log in or register to post comments

Multiple Object Placement

December 18, 2020 - 7:25pm #1

I am fairly new to Unity and Vuforia Development. But as per basic knowledge I understand that Vuforia AR Ground Plane works like this.

1. We add the AR Camera and add the license

2. We add the ground plane stage and add a gameobject to it

3. We add the plane finder and attach the ground plane stage to it.

So with this we can add the multiple objects once the ground plane reticle appears. Now i want to change the object thats getting placed. So far this is my script where i add the chosen object as a child of the ground plane stage and then remove any unwanted children. But when i tap on screen only the cube is getting placed not the sphere. The object to be placed isnt getting updated.

public void AddCube(){

        GameObject Stage = GameObject.FindGameObjectWithTag("Stage");

        foreach (Transform child in Stage.transform) {

             GameObject.Destroy(child.gameObject);

         }

        GameObject Cube = Instantiate(CubePrefab) as GameObject;

        Cube.transform.parent = Stage.transform;

        Cube.active = true;

    }



    public void AddSpehere(){

        GameObject Stage = GameObject.FindGameObjectWithTag("Stage");

        foreach (Transform child in Stage.transform) {

             GameObject.Destroy(child.gameObject);

         }

        GameObject Sphere = Instantiate(SpherePrefab) as GameObject;

        Sphere.transform.parent = Stage.transform;

        Sphere.active = true;

    }

 

AttachmentSize
Image icon uiapp.PNG38.14 KB
Image icon uiupdate.PNG5.9 KB

Multiple Object Placement

January 4, 2021 - 6:29am #2

Hi,

Please go over our Core sample app for Unity, available in the asset store.

In sample app we have a scene called GroundPlane in which we augment several objects based on touch input.

Hope this helps.

Thank you.

Vuforia Engine Support

Log in or register to post comments