Тёмный

How to create Virtual buttons with Vuforia AR & Unity3D 

CubicBrain
Подписаться 4,8 тыс.
Просмотров 204 тыс.
50% 1

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

Опубликовано:

 

23 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 280   
@kevinburgess1019
@kevinburgess1019 5 лет назад
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.
@CubicBrain
@CubicBrain 5 лет назад
Hi Kevin, Thank you very much for the kind words.
@b3armonk
@b3armonk 3 года назад
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.
@jacobyoung6876
@jacobyoung6876 6 лет назад
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.
@CubicBrain
@CubicBrain 6 лет назад
Hi Jacob, Thanks for your detailed feedback. I really appreciate it.
@bfg2600
@bfg2600 5 лет назад
again this tutorial was awesome I was worried my homework would never get done.
@princess-celestia
@princess-celestia 5 лет назад
Marvelous; I had no idea this could be done. Thanks!
@aldigangster123
@aldigangster123 5 лет назад
Thank you so much! Great & easy tutorial to see what's possible!
@DA-up9fv
@DA-up9fv 5 лет назад
I didn't have any result, because virtual button's name in inspector was "Laciebtn". I changed it to "LacieBtn" and It's work. Thanks!
@aboziad100
@aboziad100 3 года назад
you have the best tutorial i have ever seen thank you
@MsAlsada90
@MsAlsada90 4 года назад
Very nice and helpful tutorial thank you, please keep sharing such tutorials
@MsRukaya
@MsRukaya 3 года назад
Cool and layered and it was so successful ............I needed to work on the sound
@JoshyHJoshy
@JoshyHJoshy 5 лет назад
SUCH a great tutorial!
@jomanamohamedibrahim1216
@jomanamohamedibrahim1216 2 года назад
Such a great tutorial that I really needed😍
@karanpradhan4774
@karanpradhan4774 2 года назад
Exactly what I was looking for 👍
@ngonngulaptrinhjt374
@ngonngulaptrinhjt374 5 лет назад
It's very useful and fantastic. I love it
@aliagha5041
@aliagha5041 2 года назад
Thank you for this great vid!
@muhammadsameer883
@muhammadsameer883 4 года назад
NIce Tutorial , you earned my subscription
@memelab2007
@memelab2007 6 лет назад
Thank you for making this video. The crucial tip for adding a new Virtual Button via the Inspector is somehow missing from the official documentation!
@CubicBrain
@CubicBrain 6 лет назад
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.
@piqaren
@piqaren 5 лет назад
Just great, thanks alot man!
@DieoRico7
@DieoRico7 4 года назад
@CubicBrain You are a Real Augmented Reality Master! Greetings from Mexico
@shreeshind8388
@shreeshind8388 3 года назад
He is tested on computer or android
@DieoRico7
@DieoRico7 3 года назад
@@shreeshind8388 I followed the steps, first I tested on win10, then the APK file, worked fine on a 5yr old Android tablet (got it on 2015)
@shreeshind8388
@shreeshind8388 3 года назад
@@DieoRico7 thanx bro
@eSMisiek
@eSMisiek 5 лет назад
very good tutorial, subscribed :)
@jayantvishwakarma7427
@jayantvishwakarma7427 5 лет назад
Very nice tutorial.
@NabilMajid
@NabilMajid 5 лет назад
I need to trigger a function after reading the image target inside the app itself through another cell phone. is possible?
@xclusive320
@xclusive320 6 лет назад
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.
@yansen1207
@yansen1207 6 лет назад
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
@ishaangupta4941
@ishaangupta4941 6 лет назад
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
@profedavidantonio6551
@profedavidantonio6551 5 лет назад
vey good video,, from ecuador
@asbjorn.mejlvang
@asbjorn.mejlvang 5 лет назад
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.
@CubicBrain
@CubicBrain 5 лет назад
Hi, yeah, you can selec the specific animation, and in the inspector you can turn looping off.
@diegolopezpena3156
@diegolopezpena3156 5 лет назад
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
@gerytriulzi82
@gerytriulzi82 5 лет назад
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
@ahmedkhalifa3731
@ahmedkhalifa3731 6 лет назад
simple and excellent
@CubicBrain
@CubicBrain 6 лет назад
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"); } }
@tamizhselvan.v5298
@tamizhselvan.v5298 6 лет назад
Tq sir
@andonnitsolingkas7898
@andonnitsolingkas7898 5 лет назад
I got an error CS0535: `vb_anim' does not implement interface member. Any idea what to do here? I can't find the solution :(
@uzayisik7865
@uzayisik7865 5 лет назад
@@andonnitsolingkas7898 change vbButton w/ vb_anim
@andonnitsolingkas7898
@andonnitsolingkas7898 5 лет назад
@@uzayisik7865 Thanks a lot that worked! :)
@WhatYouSayin1995
@WhatYouSayin1995 5 лет назад
@@uzayisik7865 where is the vb button please?
@lucasmendes1939
@lucasmendes1939 5 лет назад
Thank you very much
@kkpklinikyadika8972
@kkpklinikyadika8972 6 лет назад
Its work. Thank
@GeospatialTechnologies
@GeospatialTechnologies 3 года назад
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?
@luisfrias06
@luisfrias06 6 лет назад
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?
@CubicBrain
@CubicBrain 6 лет назад
Hi, Thanks. Yes, you should be able to use the same code, or at least a chunk of it for other functionality.
@tietorthekiller97
@tietorthekiller97 5 лет назад
Hello, Can someone please help me?. Unity doesn't allows me to add the cube to the "Cube Ani" What I have to do??
@vanorley20
@vanorley20 3 года назад
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?
@irenecho2141
@irenecho2141 3 года назад
Hi!!! I want to ask how to call another scene but using virtual button?, I use user defined target method
@bitisi-usdt5702
@bitisi-usdt5702 5 лет назад
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??
@MohammadFaramarzian
@MohammadFaramarzian 5 лет назад
how do i specifically do a task if a certain button is pushed right now all the buttons do the same thing
@javierazamar6678
@javierazamar6678 6 лет назад
Great video, thank you ! I just want to know how did you do to use the phone camera in unity's editor. Thank you in advance
@CubicBrain
@CubicBrain 6 лет назад
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.
@akaashvakharia6233
@akaashvakharia6233 3 года назад
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
@CubicBrain
@CubicBrain 3 года назад
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)
@afifyusof7533
@afifyusof7533 3 года назад
if i have 2 target marker,and i want both of them have virtual button,do i need to make a new script?
@slujan01
@slujan01 5 лет назад
Cool !!! Runs in my laptop but not in the phone XD !!!
@codechappie
@codechappie 4 года назад
it could be consider as mixed reality ?
@sahilgarg2989
@sahilgarg2989 4 года назад
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 :)
@arailymnurekenova7286
@arailymnurekenova7286 5 лет назад
Great ,thanks
@-joshua
@-joshua 4 года назад
Bro, how about showing a text description when click the button?
@emersonseiler
@emersonseiler 5 лет назад
Can I instead of rotating the object open a website in the mobile browser from a button like this? Can anyone help me with this?
@oscarrocha7297
@oscarrocha7297 2 года назад
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?.
@QlingQlang
@QlingQlang 6 лет назад
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 .
@CubicBrain
@CubicBrain 6 лет назад
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.
@NtaGot
@NtaGot 3 года назад
when iam typing for example monobehaviour or animetor the dont get the blue color, what should i do?
@eushakhan5813
@eushakhan5813 2 года назад
what if we wanted to animate multiple objects at the same time?
@Sadiejane1000
@Sadiejane1000 5 лет назад
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.
@CubicBrain
@CubicBrain 5 лет назад
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...
@yy-hk4on
@yy-hk4on 6 лет назад
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.
@CubicBrain
@CubicBrain 6 лет назад
Hi. You need to make sure that the class name is the same as the filename. Sometimes the copy/past action can create som naming problems.
@chrisharvey7461
@chrisharvey7461 5 лет назад
amazing ty
@lesliehdezg2682
@lesliehdezg2682 6 лет назад
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"); }
@CubicBrain
@CubicBrain 6 лет назад
Hi Leslie. This should be possible, but i havn't tried it. so I don't quite know how the code would be set up.
@miteshbawankar2753
@miteshbawankar2753 5 лет назад
I got error cs0535 does not implement interface member
@4veinte584
@4veinte584 5 лет назад
Muchas gracias amigo
@ishaangupta4941
@ishaangupta4941 6 лет назад
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
@ishaangupta4941
@ishaangupta4941 6 лет назад
nevermind. i changed the rig of my model from legacy to humanoid and it worked
@anantsharma6264
@anantsharma6264 6 лет назад
Hey can we build the vuforia+unity project for android from unity personal?
@aaradhya_nishanth
@aaradhya_nishanth 3 года назад
thanks bro
@MrDestinyproduction
@MrDestinyproduction 3 года назад
How do you get a script updated?
@zeodoncio
@zeodoncio 4 года назад
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
@zainkoita7419
@zainkoita7419 5 лет назад
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 :(
@CubicBrain
@CubicBrain 5 лет назад
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).
@buhamfoydali
@buhamfoydali 4 года назад
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'?
@CubicBrain
@CubicBrain 4 года назад
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.
@buhamfoydali
@buhamfoydali 4 года назад
@@CubicBrain thank you so much
@TheAljed
@TheAljed 5 лет назад
is there a way to implement multiple buttons and each button will play an animation on the 3d model?
@CubicBrain
@CubicBrain 5 лет назад
sure, you just have to create them with different names.
@kustomworxhrv3d906
@kustomworxhrv3d906 6 лет назад
Thank you so much for your tutorial - Can you perhaps help with how to make a video play with use of a virtual button?
@CubicBrain
@CubicBrain 6 лет назад
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();
@ANDIBIDASARIABSHARILLAH
@ANDIBIDASARIABSHARILLAH 3 года назад
@@CubicBrain do i have to add public variable for the videoplayer?
@ANDIBIDASARIABSHARILLAH
@ANDIBIDASARIABSHARILLAH 3 года назад
do i change cubeAni.Play to videoPlayer.Play?
@CarlosSuarez-yj9uw
@CarlosSuarez-yj9uw 6 лет назад
Sorry, my Vuforia plugin dont have (virtual button), is my problem? i need a new version?
@CubicBrain
@CubicBrain 6 лет назад
In older versions of Vuforia, you should be able to find the Virtual button as a prefab inside the vufuria folder somewhere.
@ruudvanmierlo1829
@ruudvanmierlo1829 3 года назад
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
@silviaruz4563
@silviaruz4563 6 лет назад
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.
@CubicBrain
@CubicBrain 6 лет назад
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.
@limitlessvisuals5368
@limitlessvisuals5368 3 года назад
Why doesn't mind have a "create" animation button? Shows blank?
@hanimbuzz
@hanimbuzz 6 лет назад
why i cant add vuforia in unity ? there is no vuforia when i right click on the hierarchy tabs
@CubicBrain
@CubicBrain 6 лет назад
Hi Mira, Vuforia needs to be installed as a package when you install the newest version of unity. (just link when you add iOS or Android support)
@syedhazry
@syedhazry 4 года назад
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
@bian4553
@bian4553 2 года назад
Hey, can one of you help me? I manage to make the object to rotate, but the rotation can't stop, anyone know the solution?
@NabilMajid
@NabilMajid 5 лет назад
error here. Assets/Vuforia/Scripts/click.cs(8,14): error CS0535: `click' does not implement interface member `Vuforia.IVirtualButtonEventHandler.OnButtonPressed(Vuforia.VirtualButtonAbstractBehaviour)'
@nishantshilwanikar6037
@nishantshilwanikar6037 2 года назад
How to slow down the speed of rotation?
@jpan.sixty7
@jpan.sixty7 Год назад
I couldn't find the "Handler" of coding. Any solution for this sir?
@yonathanjesusochoa8887
@yonathanjesusochoa8887 4 года назад
Sorry, how can I open a document with a virtual button?
@claudiopascarelli3159
@claudiopascarelli3159 5 лет назад
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!
@claudiopascarelli3159
@claudiopascarelli3159 5 лет назад
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 () { } }
@CubicBrain
@CubicBrain 5 лет назад
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
@aruji-sama
@aruji-sama 3 года назад
I get an error saying 'vbnBtnObj' does not exist in current context
@derzuomaia
@derzuomaia 3 года назад
Great tutorial, is it possible to make the hand appear over the button and not the button above the hand?
@CubicBrain
@CubicBrain 3 года назад
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.
@alvarotorreblancalozano6087
@alvarotorreblancalozano6087 4 года назад
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"); } }
@shreeshind8388
@shreeshind8388 3 года назад
He is tested on computer or android tell
@joesh944494
@joesh944494 6 лет назад
NullReferenceException: Object reference not set to an instance of an object Vb_anim.Start () (at Assets/Vb_anim.cs:17) could you help me in thiz ?
@CubicBrain
@CubicBrain 6 лет назад
Hi Joe, It seems like you try to start the animation, but you havn't referenced the animation in the inspector?
@joesh944494
@joesh944494 6 лет назад
hey really thanks man
@CubicBrain
@CubicBrain 3 года назад
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.
@ulkinozgur
@ulkinozgur 3 года назад
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 ?
@user-eu7wp3jh2b
@user-eu7wp3jh2b Год назад
have you figured this out? My buttons also press by themselves..
@driateanass9431
@driateanass9431 5 лет назад
Top Tuto (y)
@adifirmanilham
@adifirmanilham 2 года назад
Hi! Do you know how to remove vuforia watermark? I've been sending requests to vuforia but there's no response at all
@CubicBrain
@CubicBrain 2 года назад
The watermark in the lower corner will, as far as i know, only be removed if you buy the premium version.
@hafizaziz1801
@hafizaziz1801 6 лет назад
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"
@anaghazachariah
@anaghazachariah 6 лет назад
I got the same problem
@CubicBrain
@CubicBrain 6 лет назад
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){}"
@anaghazachariah
@anaghazachariah 6 лет назад
still getting the same error...
@CubicBrain
@CubicBrain 6 лет назад
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"); } }
@julianhaluska1355
@julianhaluska1355 6 лет назад
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?
@akeyX
@akeyX 5 лет назад
is there something like VirtualButtons in ARKit? Or is this only available in Vuforia?
@CubicBrain
@CubicBrain 5 лет назад
Hi KLWN, not as far as I know. However Vuforia is compatible with ARKit and ARCore functionality.
@jonnyfeo7
@jonnyfeo7 6 лет назад
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!"
@CubicBrain
@CubicBrain 6 лет назад
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;".
@yesidlopez257
@yesidlopez257 6 лет назад
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.
@CubicBrain
@CubicBrain 6 лет назад
Hi Yesid. I have seen the problem before. you might need to delete the component from the inspector, and re-add it again, this might help.
@yesidlopez257
@yesidlopez257 5 лет назад
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.
@siddharthavarma2866
@siddharthavarma2866 6 лет назад
Hi , can the cube be itsefl the virtual button?
@CubicBrain
@CubicBrain 6 лет назад
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.
@mohammedsellak6523
@mohammedsellak6523 4 года назад
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
@deekshabajpai3190 4 года назад
Virtual button event handler is deprecated in latest unity versions
@wadewarman6063
@wadewarman6063 4 года назад
@@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
@camisc99
@camisc99 6 лет назад
help pleaase, I cant find the advanced options to create the button
@CubicBrain
@CubicBrain 6 лет назад
Hi Cami, it's normally a small "drop down" arrow in the inspector.
@lesliehdezg2682
@lesliehdezg2682 6 лет назад
Hi i have an error, you can help me please? Virtual Button enabled value could not be set. UnityEngine.Debug:LogError(Object)
@CubicBrain
@CubicBrain 6 лет назад
The error doesn't tell me a lot. could you elaborate?
@lesliehdezg2682
@lesliehdezg2682 6 лет назад
i solved it, thanks you!
@neal260285
@neal260285 5 лет назад
Thanks for the tutorial....But this button is not visible when I am trying to build for Android APK...kindly help
@asbjorn.mejlvang
@asbjorn.mejlvang 5 лет назад
Have you remembered to create the plane? the button is not visible outside the unity player.
@aravindr7457
@aravindr7457 6 лет назад
Thank you brain... I did everything.. But in output my button is not working.. why?? i have to build and then only check ah??
@HamisKhan
@HamisKhan 5 лет назад
Is the issue resolved now?
@aunabbas8582
@aunabbas8582 6 лет назад
how to do this hand interaction in markerless augmented reality?
@CubicBrain
@CubicBrain 6 лет назад
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.
@aunabbas8582
@aunabbas8582 6 лет назад
thank you for reply ... bro
@ahmedAlwrfaly
@ahmedAlwrfaly 6 лет назад
Hi, great vid, i was wondering if it is possible to add this button to a video, and make it play when pressing it
@CubicBrain
@CubicBrain 6 лет назад
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(); }
@abhijeetgarge4861
@abhijeetgarge4861 6 лет назад
How can we make this work with markerless AR?
@CubicBrain
@CubicBrain 6 лет назад
Hi, as far as i know, there is no support for virtual buttons or the like in markerless AR i.e. ARKit or ARCore.
@abhijeetgarge4861
@abhijeetgarge4861 6 лет назад
Thanks! Btw, your video is really cool. You have explained it really well...
@CubicBrain
@CubicBrain 6 лет назад
Abhijeet Garge thanks a lot :-)
@wadewarman6063
@wadewarman6063 4 года назад
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)
@luciusdesign9448
@luciusdesign9448 3 года назад
waiting for a reply too! any news on this?
@user-rc9rz9bl3z
@user-rc9rz9bl3z 3 года назад
same here@
@demazeuxjason881
@demazeuxjason881 3 года назад
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 :)
@6TheBACH
@6TheBACH 3 года назад
@@demazeuxjason881 thanks dude, this is the fix
Далее
ПОЛЕЗНЫЕ ЛАЙФХАКИ В PLANTS VS ZOMBIES!
00:45
The Art of Code - Dylan Beattie
1:00:49
Просмотров 4,7 млн
Vuforia Engine: How to Create Image Targets
12:32
Просмотров 87 тыс.