Search Unity

Question Vuforia Virtual Buttons not working.

Discussion in 'AR' started by Ansink, May 18, 2022.

  1. Ansink

    Ansink

    Joined:
    Oct 7, 2021
    Posts:
    10
    I am creating basic virtual buttons using Vuforia but my button presses are not being detected.

    This is the code. I don't see any reason this should not work but it doesn't.
    The area has a high concentration of feature points,
    The Virtual Button brideVB is a child of the Image target and this script is added to the Image target.
    upload_2022-5-19_1-29-35.png

    Any help appreciated
    Thanks in Advance
     
  2. Games_49Wares

    Games_49Wares

    Joined:
    Oct 17, 2021
    Posts:
    61
    Do you get any error messages ?
     
  3. Ansink

    Ansink

    Joined:
    Oct 7, 2021
    Posts:
    10
    It says the Virtual buttons could not be initialized on the target.
     
  4. Games_49Wares

    Games_49Wares

    Joined:
    Oct 17, 2021
    Posts:
    61
    Can you post the complete Error Message ? My guess would be it is saying invalid area ?
     
  5. Ansink

    Ansink

    Joined:
    Oct 7, 2021
    Posts:
    10
    upload_2022-5-20_20-34-51.png
     
  6. Games_49Wares

    Games_49Wares

    Joined:
    Oct 17, 2021
    Posts:
    61
    Please check that your virtual buttons dont touch each other. Also the virtual button is not allowed to go over the Image Target, even if it is just a bit. Is your Image Target working correctly ? The button released debug log seems wrong, because this log will show up when the button is pressed, not when it is released. Also the line
    Code (CSharp):
    1. brideVB.GetComponent<VirtualButtonBehaviour>();
    is useless, as you already have the VirtualButtonBehaviour. Please click on the first error messag and show me the detailed text. Are you pressing the button on your Image Target (in real world) ?
     
  7. Ansink

    Ansink

    Joined:
    Oct 7, 2021
    Posts:
    10
    The virtual buttons don't touch and are not anywhere near the bounds, they are all centred. The image Target does work and it shows in the console when it's recognised and if I place a 3D model that does show up when the image is detected.
    As for the log that is just a copy-paste to replace my code to check if the function is even getting called, which it's not.


    Virtual button 'ImageTarget' can only be registered for a predefined target.
    UnityEngine.Debug:LogError (object)
    Vuforia.Internal.Utility.UnityLogger:LogError (string)
    Vuforia.Internal.Utility.Log:Error (string)
    Vuforia.ImageTargetBehaviour:CreateNewVirtualButtonFromBehaviour (Vuforia.VirtualButtonBehaviour)
    Vuforia.ImageTargetBehaviour:AssociateVirtualButtons ()
    Vuforia.ImageTargetBehaviour:RegisterObserverInternal (Vuforia.Internal.Observers.IObserver)
    Vuforia.ObserverBehaviour:RegisterObserver (Vuforia.Internal.Observers.IObserver)
    Vuforia.ImageTargetBehaviour:CreateObserverFromBuffer (Vuforia.Internal.Core.IObserverFactory)
    Vuforia.ImageTargetBehaviour:CreateFromSerializedTarget ()
    Vuforia.ObserverBehaviour:OnVuforiaStarted ()
    System.Delegate:DynamicInvoke (object[])
    Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeDelegate (System.Delegate,object[])
    Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeWithExceptionHandling (System.Action)
    Vuforia.Internal.Core.Engine:OnStart ()
    Vuforia.Internal.Core.Engine:Start (System.Action)
    Vuforia.Internal.Core.Engine:Start ()
    Vuforia.VuforiaBehaviour:VuforiaInitialized (Vuforia.VuforiaInitError)
    System.Delegate:DynamicInvoke (object[])
    Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeDelegate (System.Delegate,object[])
    Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeWithExceptionHandling<Vuforia.VuforiaInitError> (System.Action`1<Vuforia.VuforiaInitError>,Vuforia.VuforiaInitError)
    Vuforia.Internal.Core.Engine:InitOnCameraReady ()
    Vuforia.WebCam:HandleFirstWebCamFrame ()
    Vuforia.WebCam:<Init>b__33_0 (bool)
    Vuforia.Internal.Utility.VuforiaCoroutineUtility/<RunCoroutineWithTimeout>d__1:MoveNext ()
    UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)



    Failed to create virtual button at startup
    UnityEngine.Debug:LogError (object)
    Vuforia.Internal.Utility.UnityLogger:LogError (string)
    Vuforia.Internal.Utility.Log:Error (string)
    Vuforia.ImageTargetBehaviour:AssociateVirtualButtons ()
    Vuforia.ImageTargetBehaviour:RegisterObserverInternal (Vuforia.Internal.Observers.IObserver)
    Vuforia.ObserverBehaviour:RegisterObserver (Vuforia.Internal.Observers.IObserver)
    Vuforia.ImageTargetBehaviour:CreateObserverFromBuffer (Vuforia.Internal.Core.IObserverFactory)
    Vuforia.ImageTargetBehaviour:CreateFromSerializedTarget ()
    Vuforia.ObserverBehaviour:OnVuforiaStarted ()
    System.Delegate:DynamicInvoke (object[])
    Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeDelegate (System.Delegate,object[])
    Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeWithExceptionHandling (System.Action)
    Vuforia.Internal.Core.Engine:OnStart ()
    Vuforia.Internal.Core.Engine:Start (System.Action)
    Vuforia.Internal.Core.Engine:Start ()
    Vuforia.VuforiaBehaviour:VuforiaInitialized (Vuforia.VuforiaInitError)
    System.Delegate:DynamicInvoke (object[])
    Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeDelegate (System.Delegate,object[])
    Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeWithExceptionHandling<Vuforia.VuforiaInitError> (System.Action`1<Vuforia.VuforiaInitError>,Vuforia.VuforiaInitError)
    Vuforia.Internal.Core.Engine:InitOnCameraReady ()
    Vuforia.WebCam:HandleFirstWebCamFrame ()
    Vuforia.WebCam:<Init>b__33_0 (bool)
    Vuforia.Internal.Utility.VuforiaCoroutineUtility/<RunCoroutineWithTimeout>d__1:MoveNext ()
    UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)

    the detailed errors.
     
  8. Ansink

    Ansink

    Joined:
    Oct 7, 2021
    Posts:
    10
    Sorry it won't let me add spaces so it doesn't consider then emojis.... it says System.Delegate: dynamicInvoke
     
  9. Ansink

    Ansink

    Joined:
    Oct 7, 2021
    Posts:
    10
    I did find the issue but forgot to add them here.
    In my case, they were not working as I had added the image directly from my system. Virtual buttons require you to upload the image to their website and download it as a database.