This Video is for older versions of vuforia, please watch • Virtual buttons in AR ... for an updated way of setting up virtual buttons. Vuforia How to create virtual buttons with Vuforia in Unity3D
While I was watching I said to myself "I wish all tutorials had this depth of content and speed of delivery". Thank you for making it and thank you for being EXCELLENT. Really well done.
Thank you for tutorial, I have learned 2 very invaluable skills from you that I never thought was possible within Vuforia. I hope to one day catch up to your level and show the world what I have created as well.
Precise video with great information! Thanks so much for posting this! I was using a slightly outdated version but it was roughly the same process, with only a few minor changes in the scripts such as using VirtualButtonAbstractBehaviour instead of VirtualButtonBehaviour. Also I was missing the advanced options and found the virtual button in Vuforia/Prefabs.
Thanks! Yeah, it also took me a while to figure out that it has been converted from a prefab in the package to a button-selection in the inspector. Dunno why they left it out/forgot.
Hi ,it's a great video for a novice like me to get hands on Vuforia and Utility, could yuou please describe any process so that on changing of the target image , a button is auto pressed .Thanks in advance.
Hi, its a great video with clear explanation what if i wanted to create a button which when we hover on it, will switch a text to another text, that means if i have two paragraph one is hidden and one is shown, and upon pressing and release the text will change to another, and vice versa. Thankyou
hey i want to add animation to a model named as robot kyle in asset store .i changed its rig to legacy. then i tried add an animation to it for rotation by animation window. but when i click on record the layout of the model changes i dont know why. please help.. and if i try to add animation in legacy then there is no animator
Hi @CubicBrain. Thanks for the tutorial. Is there a way to make the animation only go from 0 -> 1 once / not looping. I want something to go from transparent to visible while pressing the key.
I have a question If I place the button outside the target will it stop working, because after your explanation it does seem to be the case. And it woud be very helpful if it kept working even eing outside it specially if your targets are not that big
Hi, I have several objects, and I want all of them to rotate when I press the button... I already created prefabs and only the original one or the one that I add to the inspector is the one that rotates, what can I do? Please
This Video is for older versions of vuforia, please watch ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Ckw4RKKVE3k.html for an updated way of setting up virtual buttons. The script to copy and paste: using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using Vuforia; public class vbButton : MonoBehaviour, IVirtualButtonEventHandler { public GameObject vbBtnObj; public Animator cubeAni; // Use this for initialization void Start () { vbBtnObj = GameObject.Find("LacieBtn"); vbBtnObj.GetComponent().RegisterEventHandler(this); cubeAni.GetComponent(); } public void OnButtonPressed(VirtualButtonBehaviour vb) { cubeAni.Play("cube_animation"); Debug.Log("Button pressed"); } public void OnButtonReleased(VirtualButtonBehaviour vb) { cubeAni.Play("none"); Debug.Log("Button released"); } }
Hi, I am trying to build an AR app using ARCore in Unity. I have ten images and ten URL links to websites; I need to link the ten images with those ten URL links. Simply, when I scan the image with the phone's camera, I want the URL to open directly. Could you help me by explaining how can I do that?
Great! Just saw your tutorial and this explanation is quite what I was looking for, thanks! Can the same process and btn code be used to trigger an animation or AR video in an Android app?
Hello, good video, I have a problem, I am developing an AR app with Vuforia that consists of a 3D model to learn human anatomy, with the touch I can rotate, scale, move and select each part of the body and it shows me a label, I also have buttons; ** that when the 3D model is in the same direction as a Canvas button, pressing it also selects the 3D Model ** How can I make sure that the Model is not selected when I press a button?
sir I got this error: Exception in callback: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.EntryPointNotFoundException: qcarSetAllowedFusionProviders how to fix this??
Hi Javier, Thanks a lot for your feedback. I'm not sure if that is possible, as you would need a connection between the two devices. there once was an app called something like "unity Remote" but I think its been discontinued.
can you please update the code bcs unity has depreciated the 'IVirtualButtonEventHandler' and it shows there is no namespace as virtualbuttoneventhandler ,i want the updated version of this code in description
Hi Akaash, i have made an updated video with the new code and procedure: This Video is for older versions of vuforia, please watch ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Ckw4RKKVE3k.html for an updated way of setting up virtual buttons. (from the description)
IVirtualButtonEventHandler has been depreciated from vuforia 9.1 and now i have to use RegisterOnButtonPressed() instead of RegisterEventHandler() but i don't know how to implement this method RegisterOnButtonPressed(). The only thing i know is that a "UnityAction" will be passed as an argument to RegisterOnButtonPressed() but i don't know how to make function call whenever a virtual button is pressed. I'm totally confused about all these things. So i request you to please suggest something or you can provide a piece of code because it will be more clear to me. Thank You :)
Hello everyone. I have problem using 'VirtualButtonBehaviour' in virtual button. I´ve replaced it with 'VirtualButtonAbstractBehaviour' instead but didn´t work. I´m using 2019 version of unity and I would know what is the new code to work with virtual button?.
Hi, this is a really awesome vid is hould say , i was wondering if it is possible hook up the virtual button with a UI button to sort of like play music,etc .
Hi Daniel. by UI, you mean stuck to the camera as a sort of overlay? I don't think that is possible, as the virtual buttons only get triggered when a certain area of a picture/marker gets occluded/covered. You would not be able to do that with a moving background.
Hi CubicBrain, I have learned soo much from your videos! Thank you for taking the time to share your expertise. I have a question that maybe you can help me solve. I have virtual buttons working in one project and I have an 3d target object recognized in another project. I would like to create something where when the 3d object is recognized it changes scene to the virtual buttons. Is there a way of combining these two or is there a better way of accomplishing this? Thank you for your time and expertise and sharing with those trying to learn.
Hi, thanks for the kind feedback. Im not completely sure what you specifically want to do. be any state, object recog or other can be used as a trigger. for the tracking to be used as a trigger I can't remember the specific method, but it's something like tracking found, or ontracking...
I add(copy and paste) the script on the image target, and I get an error below: the associated script cannot be loaded. Please fix any compile errors and assign a valid script.
CAN I use a vuforia virtual button and aply my own transform with a script instead of Animator? for example: public void OnButtonPressed(VirtualButtonBehaviour vb) { cubo.transform.position = new Vector3 (1, 0, 0); Debug.Log("change position"); }
Hey i am facing a problem in putting my model in the Cube ani tab. it is not allowing me to drop it there. I used robot kyle model and set up an animation please reply fast
Hi... TKS for the Job. Great vídeo. But i got an error related to the "RegisterEventHandler(this)" It is not recognazed by the VisualStudio and i get an error massage at the compilation time. I re-check the code many times and every thing is fine. help me I cant find the issue Thnks
Hi! i am new to C# but i have gotten as far as your video has shown, how would add more buttons? Forexample, i have 9 spheres orbiting and i want to make one of them stop, the script works but if i want to make another sphere, i would need another button to make that one stop. please help :(
Hi, to add more buttons you can just create another vbBtnObj in the script, and then use the same procedure as with the first button. the important part is just the new name (ex. vbBtnObj2).
Hi CubicBrain , thank you for very very amazing tutorial! It works well. I just want to ask, method 'OnButtonReleased(VirtualButtonBehaviour vb)' what means? Is it the same thin like 'when button is not pressed'?
Hi Max, the method OnButtonReleased is triggered when you have the button pressed (your hand over the area of the button), and then release, or remove your hand blocking the part of the marker.
Hi, you have to add the a video to your scene, and a video component to your script, and then your should be able to write a play function for your script. Inside of the virtual button functions, add this: var videoPlayer = GetComponent(); videoPlayer.Play();
Hey guys I have problems with the script. I read all the comments but I can't manage it. Can someone share their whole Unity Project with me? I am using version Unity 2019.4.11f1
You see I have the following problem I have a PC with a blackmagic video capture to which I connect a camera, this camera can not see it in unity, could you tell me how I can configure it as a webcam and thus be able to try augmented reality, Thanks in advance, I hope you can help me.
Hi, it seems like a really complicated setup, and unfortunately I don't know any solution. I just test with a ultra cheap webcam (not even HD), and then on my android phone when I build the project.
Hai CubicBrain, yr'r tutorial is very helpful... can u help me my code doesn't go well n it's declare nothing and it not popup vb Btn Obj and Cube Ani ... i feel sad
error here. Assets/Vuforia/Scripts/click.cs(8,14): error CS0535: `click' does not implement interface member `Vuforia.IVirtualButtonEventHandler.OnButtonPressed(Vuforia.VirtualButtonAbstractBehaviour)'
Hi, very interesting tutorial. I've implemented it and recognized that the cube, releasing the button, returns in it original position. Can you suggest me a way to stop the cube in its actual position during the animation, and restart the animation (by pressing the button) form that "intermediate" position? Thank you!
Sorry, already solved! Here the code for those interested: using System.Collections; using System.Collections.Generic; using UnityEngine; using Vuforia; public class Rotatebtn_anim : MonoBehaviour, IVirtualButtonEventHandler { public GameObject vbBtnObj; public Animator earthAni; // Use this for initialization void Start () { vbBtnObj = GameObject.Find("RotateBtn"); vbBtnObj.GetComponent().RegisterEventHandler(this); earthAni.GetComponent(); } public void OnButtonPressed(VirtualButtonBehaviour vb) { earthAni.enabled = true; earthAni.Play("earth_rotate"); Debug.Log("Button pressed"); } public void OnButtonReleased(VirtualButtonBehaviour vb) { earthAni.enabled = false; Debug.Log("Button released"); } // Update is called once per frame void Update () { } }
Hi Claudio, The only real way to do this without resetting the animation back to start would be to "fake" a pause of the animation with the animation speed. something like: earthAni.speed = 0;. this thread might help you: answers.unity.com/questions/1211034/how-to-pause-an-animation.html
Hi Omaia, I don't think so, the vuforia engine (as far as i know) does not support occlusion, probably because a lot of devices don't have a depth sensor.
The code is deprecated. I solved it with this code: public class vb_anim : MonoBehaviour { public GameObject button; // Start is called before the first frame update void Start() { button.GetComponent().RegisterOnButtonPressed(OnButtonPressed); button.GetComponent().RegisterOnButtonReleased(OnButtonReleased); } public void OnButtonPressed(VirtualButtonBehaviour vb) { Debug.Log("Pressed"); } public void OnButtonReleased(VirtualButtonBehaviour vb) { Debug.Log("Releassed"); } }
This Video is for older versions of vuforia, please watch ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Ckw4RKKVE3k.html for an updated way of setting up virtual buttons.
Hello, your video is very nice tutorial. I am applying the same as your video, but without touching the virtual button, the cube constantly rotates around itself and when I touch it, nothing happens. In the console, it constantly writes pressed and released. Actually, I'm trying to make a virtual button, but I still haven't been able to do it. The purpose of making a virtual button is I want to create a keypad and for example I want to put 9 buttons from 1 to 9, so when I press 1 in the air, I want it to write 1 on the screen, when I press 2, I want it to type 2 and for example, I want to enter a password. I cannot overcome the virtual button problem. Do you have any suggestions? Do you have a version of unity or vuforia package version that you suggested to make a virtual button. Can you help me ?
i got problem at image target, that we need to add component and i got error "does not implement interface member" at this code "public class vbButton : MonoBehaviour, IVirtualButtonEventHandler"
Hi, if you use "IVirtualButtonEventHandler" its an interface, that dictates which functions MUST be present in the script (class). so, you need "public void OnButtonPressed(VirtualButtonBehaviour vb){}" and "public void OnButtonReleased(VirtualButtonBehaviour vb){}"
Hi Anagha. here is a copy/paste of the code i have, try to compare the two. there might be a typo, or a letter in the wrong case (upper or lower): using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using Vuforia; public class vbButton : MonoBehaviour, IVirtualButtonEventHandler { public GameObject vbBtnObj; public Animator cubeAni; // Use this for initialization void Start () { vbBtnObj = GameObject.Find("LacieBtn"); vbBtnObj.GetComponent().RegisterEventHandler(this); cubeAni.GetComponent(); } public void OnButtonPressed(VirtualButtonBehaviour vb) { cubeAni.Play("cube_animator"); Debug.Log("Button pressed"); } public void OnButtonReleased(VirtualButtonBehaviour vb) { cubeAni.Play("none"); Debug.Log("Button released"); } }
I got the same error. I changed the type of the parameter vb in the two functions into "VirtualButtonAbstractBehaviour". Now it works. Mayber there was a change in the Vuforia library?
Good evening, first of all, congratulations for your excellent videos, your channel is great! How can I press the button and when I remove my hand the animation is executed without needing to keep it on the button, and when I put my hand back it will be paused. Is there any solution or form? Thank you so much! Regards! "Buenas noches, primeramente, felicitaciones por sus excelentes videos, su canal es genial! Como puedo lograr presionar el boton y al retirar mi mano la animacion se ejecute sin necesidad de mantenerla sobre el boton, y al poner nuevamente la mano esta se pause. Hay alguna solución o forma? Muchas Gracias! Saludos!"
Hi Firthu. thank you for your kind words. to achieve this you would need a conditional statement (if statement or switch/case) that check the state of the current animation. So, if the animation isn't running, then play the animation, however if else the animation is already running, then pause the current animation. to unpause, you would then have another else if that looks if the current animation is in the pause mode. As far as I know, there isn't any "Pause();" function for animations, however there is a speed setting "animation["jumping"].speed = 0;".
Hi, Thanks for such a great video, very good information. I have a problem in the final part, I do not load the "script, I get this message:" The associated script can not be loades. Please fix any compile erros and assign a valid script "I have compiled the code in" visual studio "and I have no problem. What could I do? Thank you.
Hello, thank you very much for the answer, I realized that I had a problem when naming the 3D model, solve this and everything worked perfectly. I want to ask you if you have worked with BEACONS and AR, I would be very helpful and tutorial on this topic. Thank you.
Hi, I think you might be able to do it, however I don't know how well it will work with a 3D object. if you put a cube (or other 3D object) in the place of the plane as a child of the button area, it might work.
I add(copy and paste) the script on the image target, and I get an error below: Assets\vb_anim.cs(6,40): error CS0246: The type or namespace name 'IVirtualButtonEventHandler' could not be found (are you missing a using directive or an assembly reference?)
@@deekshabajpai3190 I have the same problem. When i remove IVirtualButtonEventHandler, then i get an error: "'VirtualButtonBehaviour' does not contain a definition for 'RegisterEventHandler'". if i change "OnButtonPressed(VirtualButtonBehaviour vb)" to "OnButtonReleased(VirtualButtonAbstractBehaviour vb)", I then get an error: The type or namespace name 'VirtualButtonAbstractBehaviour' could not be found (are you missing a using directive or an assembly reference?) If i take out the line "vbBtnObj.GetComponent().RegisterEventHandler(this);" I do not get errors in the Unity console, but then the Virtual Button doesnt work. Can you help? Im at a loss
Hi Aun, You would need to use something like ARCore or ARKit, however then you would still need to identify some area to cover for the function to trigger. I'm actually not sure how you would do that.
Hi, Sure. You just have to get the video playback component onto a gameobject (drag n' drop a video to a plane), and the trigger it with your code. the code couls be something like: public void OnTriggerEnter() { var videoPlayer = GetComponent(); videoPlayer.Play(); }
Great video, but unfortunately, 'IVirtualButtonEventHandler " has been deprecated. Im not exactly experienced with writing script, any idea how to fix this? (Using Unity 2019.4.1f1 and Vuforia 9-2-7)
Fyi : you must delete IVirtualButtonHandler and replace the part ""VirtualButton.GetComponent() .RegisterEventHandler(this); "" by "" VirtualButton.GetComponent().RegisterOnButtonPressed(OnButtonPressed); VirtualButton.GetComponent().RegisterOnButtonReleased(OnButtonReleased); "" I hope it helps you :)