Log in or register to post comments

BUG with virtual button!

August 8, 2012 - 12:04am #1

Hi all!

I try to use virtual button in unity3d with Vuforia.

I build project with:

- AR camera:

             + dataset: Stonesandchips

             +default initialization Error Handler

             + QCARBehaviour

- directional light

- Imagetarget:

          + cube

          + virtualbutton

when i run this project , i see only Cube but cannot see any button. And logbug show"Attempting to update a virtual button without a dataset".

pls help me.

thank all.

 

BUG with virtual button!

December 5, 2012 - 12:50pm #14

Those errors are arising because you're referencing objects that you haven't defined (e.g. rendererComponents ). See my PM.

BUG with virtual button!

December 3, 2012 - 4:43am #13

These are the error code i was getting with the

 //{

        //Renderer[] rendererComponents = GetComponentsInChildren<Renderer>();

        //Collider[] colliderComponents = GetComponentsInChildren<Collider>();

//}

        // Enable rendering:

        //foreach (Renderer component in rendererComponents)

 

parts of this script. 

http://i719.photobucket.com/albums/ww194/dholroyd01/consoleerrors.jpg

BUG with virtual button!

December 3, 2012 - 4:30am #12

I was getting these errors using commented out script for render and coliders so I tried it with taking adding the single line renderer.enable =  in pressed and released but now i get this yellow console: 

 

Assets/VirtualButtonEventHandler.cs(16,24): warning CS0414: The private field `VirtualButtonEventHandler.P90' is assigned but its value is never used

 

Script:

 

using UnityEngine;

using System.Collections.Generic;

 

public class VirtualButtonEventHandler : MonoBehaviour,

                                         IVirtualButtonEventHandler

{

 

    

 

    private GameObject P90;

    

 

    void Start()

    {

        // Register with the virtual buttons TrackableBehaviour

        VirtualButtonBehaviour[] vbs = GetComponentsInChildren<VirtualButtonBehaviour>();

        for (int i = 0; i < vbs.Length; ++i)

        {

            vbs[i].RegisterEventHandler(this);

        }

 

        // Get handle to the P90 object

        P90 = transform.FindChild("P90").gameObject;

 

        

    }

 

 

    // Called when the virtual button has just been pressed:

       public void OnButtonPressed(VirtualButtonBehaviour vb)

    {

        if( vb.VirtualButtonName.Equals("ShowHideVB") )

//{

        //Renderer[] rendererComponents = GetComponentsInChildren<Renderer>();

        //Collider[] colliderComponents = GetComponentsInChildren<Collider>();

//}

        // Enable rendering:

        //foreach (Renderer component in rendererComponents)

        {

            //component.enabled = true;

renderer.enabled = false;

        }

 

        // Enable colliders:

        //foreach (Collider component in colliderComponents)

        {

            //component.enabled = true;

        }

}

   

    // Called when the virtual button has just been released:

 

   public void OnButtonReleased(VirtualButtonBehaviour vb)

{

        if( vb.VirtualButtonName.Equals("ShowHideVB") )

//{

        //Renderer[] rendererComponents = GetComponentsInChildren<Renderer>();

        //Collider[] colliderComponents = GetComponentsInChildren<Collider>();

//}

        // Enable rendering:

        //foreach (Renderer component in rendererComponents)

        {

            //component.enabled = false;

renderer.enabled = true;

        }

 

        // Enable colliders:

        //foreach (Collider component in colliderComponents)

        {

            //component.enabled = false;

        }

}

}

 

 

 

BUG with virtual button!

December 1, 2012 - 2:51pm #11

Your code looks OK, what are the errors that you're getting?

BUG with virtual button!

December 1, 2012 - 7:25am #10

Thanks David I had a look at the VB sample. And edited the VBeventhandler to this. But when I go to attach it it gives me a compiling error and also console is full of issues.

 

http://i719.photobucket.com/albums/ww194/dholroyd01/consoleerrors.jpg

http://i719.photobucket.com/albums/ww194/dholroyd01/Cantaddscript.jpg

 

/*==============================================================================

            Copyright (c) 2012 QUALCOMM Austria Research Center GmbH.

            All Rights Reserved.

            Qualcomm Confidential and Proprietary

==============================================================================*/

 

using UnityEngine;

using System.Collections.Generic;

 

public class VirtualButtonEventHandler : MonoBehaviour,

                                         IVirtualButtonEventHandler

{

 

    

 

    private GameObject mP90;

    

 

    void Start()

    {

        // Register with the virtual buttons TrackableBehaviour

        VirtualButtonBehaviour[] vbs = GetComponentsInChildren<VirtualButtonBehaviour>();

        for (int i = 0; i < vbs.Length; ++i)

        {

            vbs[i].RegisterEventHandler(this);

        }

 

        // Get handle to the P90 object

        mP90 = transform.FindChild("P90").gameObject;

 

        

    }

 

 

    // Called when the virtual button has just been pressed:

       public void OnButtonPressed(VirtualButtonBehaviour vb)

    {

        if( vb.VirtualButtonName.Equals("ShowHideVB") )

{

        Renderer[] rendererComponents = GetComponentsInChildren<Renderer>();

        Collider[] colliderComponents = GetComponentsInChildren<Collider>();

}

        // Enable rendering:

        foreach (Renderer component in rendererComponents)

        {

            component.enabled = true;

        }

 

        // Enable colliders:

        foreach (Collider component in colliderComponents)

        {

            component.enabled = true;

        }

}

   

    // Called when the virtual button has just been released:

 

    public void OnButtonReleased(VirtualButtonBehaviour vb)

{

        if( vb.VirtualButtonName.Equals("ShowHideVB") )

{

        Renderer[] rendererComponents = GetComponentsInChildren<Renderer>();

        Collider[] colliderComponents = GetComponentsInChildren<Collider>();

}

        // Enable rendering:

        foreach (Renderer component in rendererComponents)

        {

            component.enabled = false;

        }

 

        // Enable colliders:

        foreach (Collider component in colliderComponents)

        {

            component.enabled = false;

        }

}

}

BUG with virtual button!

December 1, 2012 - 7:20am #9

Thanks David I had a look at the VB sample. And edited the VBeventhandler to this. But when I go to attach it it gives me a compiling error and also console is full of issues.

 

http://i719.photobucket.com/albums/ww194/dholroyd01/consoleerrors.jpg

http://i719.photobucket.com/albums/ww194/dholroyd01/Cantaddscript.jpg

 

/*==============================================================================

            Copyright (c) 2012 QUALCOMM Austria Research Center GmbH.

            All Rights Reserved.

            Qualcomm Confidential and Proprietary

==============================================================================*/

 

using UnityEngine;

using System.Collections.Generic;

 

public class VirtualButtonEventHandler : MonoBehaviour,

                                         IVirtualButtonEventHandler

{

 

    

 

    private GameObject mP90;

    

 

    void Start()

    {

        // Register with the virtual buttons TrackableBehaviour

        VirtualButtonBehaviour[] vbs = GetComponentsInChildren<VirtualButtonBehaviour>();

        for (int i = 0; i < vbs.Length; ++i)

        {

            vbs[i].RegisterEventHandler(this);

        }

 

        // Get handle to the P90 object

        mP90 = transform.FindChild("P90").gameObject;

 

        

    }

 

 

    // Called when the virtual button has just been pressed:

       public void OnButtonPressed(VirtualButtonBehaviour vb)

    {

        if( vb.VirtualButtonName.Equals("ShowHideVB") )

{

        Renderer[] rendererComponents = GetComponentsInChildren<Renderer>();

        Collider[] colliderComponents = GetComponentsInChildren<Collider>();

}

        // Enable rendering:

        foreach (Renderer component in rendererComponents)

        {

            component.enabled = true;

        }

 

        // Enable colliders:

        foreach (Collider component in colliderComponents)

        {

            component.enabled = true;

        }

}

   

    // Called when the virtual button has just been released:

 

   public void OnButtonReleased(VirtualButtonBehaviour vb)

{

        if( vb.VirtualButtonName.Equals("ShowHideVB") )

{

        Renderer[] rendererComponents = GetComponentsInChildren<Renderer>();

        Collider[] colliderComponents = GetComponentsInChildren<Collider>();

}

        // Enable rendering:

        foreach (Renderer component in rendererComponents)

        {

            component.enabled = false;

        }

 

        // Enable colliders:

        foreach (Collider component in colliderComponents)

        {

            component.enabled = false;

        }

}

}

BUG with virtual button!

November 30, 2012 - 1:53pm #8

Make sure that you're loading and activating a dataset on your ARCamera, and assigning a target to your ImageTarget. Also your cube should be a child of the ImageTarget, not the VB. 

To have the VB events affect rendering, take a look at the VirtualButtonEventHandler script in the Virtual Buttons sample. This has an OnButtonPressed method. You can apply rendering selective here, based on the VB name for example. You'll need to add the VirtualButtonEventHandler to your ImageTarget, not the VB(s).

 

    public void OnButtonPressed(VirtualButtonBehaviour vb)

    {

        if( vb.VirtualButtonName.Equals("name") ){

        Renderer[] rendererComponents = GetComponentsInChildren<Renderer>();

        Collider[] colliderComponents = GetComponentsInChildren<Collider>();

 

        // Enable rendering:

        foreach (Renderer component in rendererComponents)

        {

            component.enabled = true;

        }

 

        // Enable colliders:

        foreach (Collider component in colliderComponents)

        {

            component.enabled = true;

        }

}

}

BUG with virtual button!

November 30, 2012 - 9:39am #7

Hi, im having the same problem, i dont think its a "bug" but more of case of not knowing how to set up an event. If you could show a same script of how to have a button doing a simple event like renderer.enable and then how to link it to the VB. Thanks Dan

 

<a href="http://s719.beta.photobucket.com/user/dholroyd01/media/VBerror1.jpg.html" target="_blank"><img src="http://i719.photobucket.com/albums/ww194/dholroyd01/VBerror1.jpg" border="0" alt="Photobucket"/></a>

 

<a href="http://s719.beta.photobucket.com/user/dholroyd01/media/VBinspectorerror.jpg.html" target="_blank"><img src="http://i719.photobucket.com/albums/ww194/dholroyd01/VBinspectorerror.jpg" border="0" alt="Photobucket"/></a>

BUG with virtual button!

August 9, 2012 - 4:21pm #6

Hello,

Virtual buttons are invisible and define a region on your target as a button to be activated when that region is occluded. Do you have an action associated with pressing the virtual button? Can you occlude the defined area on your target and get the desired action of the virtual button?

Thank you,

-Peter

BUG with virtual button!

August 8, 2012 - 9:22pm #5

i run it on my device, but i see only the cube, not see any button.

this is my screenshort. http://np4.upanh.com/b2.s28.d1/6fe696fe1a72d13b8d3ddc75ffacc1ad_47968784.ar.jpg

 

BUG with virtual button!

August 8, 2012 - 7:24pm #4

Virtual Buttons don't function in Unity's Play Mode. Try testing this by deploying your Unity scene as an app, to a device.

BUG with virtual button!

August 8, 2012 - 7:11pm #3

Thank David.

i am sure it cover imagetarget, because i create it form prefab, and y=0.001.

when i press button play on unity3d, i can see a cube an a green rectangular(Virtual Button). but log show:

"Attempting to update a virtual button without a dataset

UnityEngine.Debug:LogError(Object)

VirtualButtonBehaviour:UpdateSensitivity(DataSet) (at Assets/Qualcomm Augmented Reality/Scripts/VirtualButtonBehaviour.cs:344)

VirtualButtonBehaviour:LateUpdate() (at Assets/Qualcomm Augmented Reality/Scripts/VirtualButtonBehaviour.cs:553)"

can you show me one simple example.

thank again.

 

 

BUG with virtual button!

August 8, 2012 - 4:41pm #2

The virtual button is invisible. Be sure to place it over a region of the target where there are details.  And then test the VB by covering that region. You should see the VB events acknowledged in your log.

Log in or register to post comments