artoolkitx / artoolkit5

ARToolKit v5.x
Other
108 stars 28 forks source link

setactive(true/false) multiple prefabs/gameobjects that are childs of a single ARtoolkit marker #134

Closed ThorstenBux closed 6 years ago

ThorstenBux commented 6 years ago

Issue by novaBrothers Thursday Jan 11, 2018 at 23:51 GMT Originally opened as https://github.com/artoolkit/artoolkit5/issues/377


Hello and thank you in advance for helping me.

I found a similar question to mine here https://github.com/artoolkit/artoolkit5/issues/306. but it doesnt fully answer my question.

im making an AR app where the user clicks on different buttons to show different 3d models on the same marker. the 3d models are children of the gameobject with the ARTrackable script. when the user clicks the shoe button the only 3d model that shows on the marker is the shoe, and the other 3d models should be hidden.

If you are able to help please reach out to me and i can post pictures and code if necessary.

thanks

ThorstenBux commented 6 years ago

Comment by ThorstenBux Friday Jan 12, 2018 at 05:40 GMT


The only thing missing in #306 is the button click. And tbh that is not ARTK related

ThorstenBux commented 6 years ago

Comment by novaBrothers Friday Jan 12, 2018 at 19:09 GMT


My issue is not associated with the button click. my issue is that no matter what i try i am not able to setactive(false) or setactive(true) on a gameObject (i.e. ShoeGO) that is a child of the gameObject (productModels) within the MarkerSceneUIManager.

image

The snippet that of code that controls this is

public int thisMarker = -1;

public override void OnMarkerFound(ARTrackable marker){
        Debug.Log (marker.BarcodeID);
        Debug.Log ("thisMarker= "+buttonScript.thisMarker);

        //makeeveruy marker data invis
        for(int i = 0; i < OurUserElements.Length; i++){
            OurUserElements [i].SetActive (false);
        }//end for

        //set the right one visible
        Debug.Log ("before");
        OurUserElements [2].SetActive (true);
        //OurUserElements [thisMarker].SetActive (true);
        Debug.Log ("after");

    }//end on marker foun
ThorstenBux commented 6 years ago

Please post in the Unity repo or artoolkit. Also this does not sound ARToolKit related.