How to activate/start animations in AR with either touch input or keyboard press using Unity3D and Vuforia. Simple touch input on a phone.
Пікірлер: 52
@CubicBrain6 жыл бұрын
using System.Collections; using System.Collections.Generic; using UnityEngine; public class animHDD : MonoBehaviour { public Animator anim; // Use this for initialization void Start () { } // Update is called once per frame void Update () { /* if(Input.GetKeyDown("1") && anim.GetCurrentAnimatorStateInfo(0).IsName("none")) { anim.Play("open"); } else if (Input.GetKeyDown("1") && anim.GetCurrentAnimatorStateInfo(0).IsName("close")) { anim.Play("open"); } else if (Input.GetKeyDown("1") && anim.GetCurrentAnimatorStateInfo(0).IsName("open")) { anim.Play("close"); }*/ for (int i = 0; i
@ashishankit99114 жыл бұрын
Thanks
@123456789jameswhite5 жыл бұрын
Hey, great video. how would you do this for multiple image targets if you wanted to trigger them independently?
@jacobyoung68766 жыл бұрын
Once again, great video! I had always wondered how accessing mobile touch worked. Where did you learn to program for touch? I'm looking to get started using different kinds of touch commands (such as pinch) to scale objects in Vuforia. If you have any advice, please let me know!
@CubicBrain6 жыл бұрын
Hi Jacob, thanks once again for the feedback. I don't have a lot of experience with touch commands, but its actually on my list of future features to build, and make a tutorial about.
@pauldouglas69316 жыл бұрын
Another brilliant tutorial - thanks!
@CubicBrain6 жыл бұрын
Thanks a lot Paul.
@abdulmajidmyarima4184 жыл бұрын
@@CubicBrain good day and nice to meet you can we talk please so that you can assist me am working on AR for my final year project
@xc58385 жыл бұрын
Thank you so much for posting this video this was exactly what I was looking for. I would also like to ask you a follow-up question. How can you detect a user's touch on a mobile device on a specific part of the 3D model? For example, I only want to play the open animation after pressing the 3rd square from the first row and only play the ending animation on the last square from the last row. Can this be done?
@CubicBrain5 жыл бұрын
Hi Luke, thanks a lot. Sure. I made a video where you use ray-casting to check for collisions with 3D obejcts (and use it as triggers): kzbin.info/www/bejne/nprCfHemeJahsM0
@aegiswang15 жыл бұрын
Thank you!! It's very helpful!!
@0099boomerang3 жыл бұрын
Can we use interface slider for triggering and controlling AR object animations?
@leabarrionuevo4 жыл бұрын
hi! thanks for your videos, they are amazing. In this moment, i want to do the same but with a touch cube (and reproduce the animation), how do i do it?
@problemsinspace6 жыл бұрын
These are great videos. Thanks.
@CubicBrain6 жыл бұрын
Thanks a lot.
@davechaffey34935 жыл бұрын
Great explanation. Kudos to you!
@CubicBrain5 жыл бұрын
Thanks!
@WBBG16 жыл бұрын
Great Video! Do you have any tips or walkthroughs on how to implement this using the ground plane feature? Currently, if you try to use touch input on a model using ground plane, it just clones the model. Is there a way to interact with ground plane models using touch input? Thanks!
@CubicBrain6 жыл бұрын
Hi Terry, I havn't yet tied the ground plane feature, but I am pretty certain that I will make a video about it in the future.
@csellers9002 жыл бұрын
I'm a bit of a noob inside of unity. Am I missing something? None of the models I import into unity have the Model, Rig, Animation, Materials tabs inside the Inspector window. I can access their animations inside the animator window but the inspector window just shows Tag, Prefab, Transform, and Animator.
@CubicBrain2 жыл бұрын
Your animation might already be set up in the imported model. You seem to be viewing a prefab, and not the actual model. In the video I use an imported FBX file where the animation is stored as a "clip"
@csellers9002 жыл бұрын
@@CubicBrain It was a rigged/animated game model I bought from sketchfab and imported using their store plugin. It uses separate fbx files for all the animations. At first I thought I was selecting the wrong object in the object tree but none of the underlying layers have those features. Does this mean I have to manually import the fbx and re-setup all the animations inside it?
@CubicBrain2 жыл бұрын
@@csellers900 you might have to. if you can import the FBX with animations in them you should be able to find them in the project folder and just add them to the animation controller of your main object
@csellers9002 жыл бұрын
@@CubicBrain Thanks for the response! I tried creating a new blank 3D project and did a generic import of the same model but I still don't have those options available so I tried importing other random fbx files that have animations and none of them have that option available in the Inspector tab. I'm at a loss on what's causing this but I'll update if I ever figure it out.
@disconuts315 Жыл бұрын
I know it's a long shot this video is 5 years old but i can't for the life of me find a way to trigger a sound when the screen is touched, could you help me?
@jagdelhi4 жыл бұрын
Could u suggest some script in unity Vuforia AR, that starts animation onTrackingFound and restart on another time ...
@katermurr5 жыл бұрын
Trying to find a way to combine this script with my Audio clips (with loop). No luck so far. do you have some hints or did anyone already implement this?
@katermurr5 жыл бұрын
using System.Collections; using System.Collections.Generic; using UnityEngine; public class BowAnim : MonoBehaviour { public Animator anim; AudioSource myAudio; // Use this for initialization void Start () { anim = GetComponent(); } // Update is called once per frame void Update () { /* if(Input.GetKeyDown("1") && anim.GetCurrentAnimatorStateInfo(0).IsName("none")) { anim.Play("jump"); } else if (Input.GetKeyDown("1") && anim.GetCurrentAnimatorStateInfo(0).IsName("idle")) { anim.Play("jump"); } else if (Input.GetKeyDown("1") && anim.GetCurrentAnimatorStateInfo(0).IsName("jump")) { anim.Play("idle"); }*/ for (int i = 0; i
@miqdadagilamarullah5 жыл бұрын
Is that 3d from blender?
5 жыл бұрын
you could create a tutorial so that when you press the screen a video will be put on full screen, thanks
@JoshyHJoshy6 жыл бұрын
Hi there, There are some AR apps around that when you hover the tablet on an engine part, for example, some animation starts playing, for instance how to dismantle that part or how to fix it, as well as instructional text on top of the real object. Is it the same principle as this tutorial, that instead of an image target (marker) a 3D object is recognized and then some animation is played or text is shown? Can Vuforia does this?
@CubicBrain6 жыл бұрын
Hi, it is kind of the same principle, however the shown functionality is only for image targets (flat surface). Vuforia has recently updated, and now support model targets (3D models), however I have yet to test this new feature.
@adithyasathya25786 жыл бұрын
Hey there. I just have a few questions... So I have made an fbx animation from a blender asset that uses virtual button. When it play, some objects in the asset dissapear if you get really close to the object. Is there a way to fix this bug? Also can the touch input in this video be paired to a on-screen button? And is there a tutorial for that. I would likd to also request a video on UI in an AR app? Thank you so much.
@CubicBrain6 жыл бұрын
Hi, Regarding the distance of the object to the ARCamera, you should be able to fix this by changing the "Clipping Planes" for the camera in the settings for it inside the inspector. The simple touch input in this tutorial is only for one animation or function at a time, as it only checks if the screen has been touched. If you want a UI and/or button you will have to use ray casting. I am currently planing a tutorial with simple touchscreen UI and ray casting, but I haven't recorded it yet.
@adithyasathya25786 жыл бұрын
CubicBrain Thank you! I tries to build the app to test it on my surface pro pc, but after the Unity logo, the app is just a black screen. It doesn't ask for camera permission. How do I fix this?
@CubicBrain6 жыл бұрын
Hi, I don't know if the Surface pro webcam driver is supported in Vuforia. You might want to ask their tech support or forum at their site.
@emporato6 жыл бұрын
Could you give us the text content of the script or the script file itself...? I am kind of new at unity... thanks in advance
@CubicBrain6 жыл бұрын
sure, its now pinned to the top.
@miqdadagilamarullah5 жыл бұрын
How can i export .fbx with texture
@jonhgcan43986 жыл бұрын
How can i use multiple VirtualButtons to play an animation? So far i got to work only 1 button. Is a simple exercise of jump,atk and block on a 3d mode.. Anyone have a documentation for the virtual buttons or an idea of how to manage them in code?
@CubicBrain6 жыл бұрын
Hi John, in my video about virtual buttons you can just add more gameobject variables in the code, or set up an array of buttons. kzbin.info/www/bejne/e53Qq3yna9inhKs&lc=Ugx4ULl8UPIbRMfDay14AaABAg it this what you are looking for?
@jonhgcan43986 жыл бұрын
yeah,Thanks!!! :D with that video i made my button but could not figure how to control more buttons to do trigger differents animation depending on wich was "pressed", somewhat a mix between both videos.
@CubicBrain6 жыл бұрын
If you create more buttons, you can just make a new set of functions in the update (including a VbBtnObj2 gameobejct variable) then you should be able to add the new buttons, and trigger their functions.
@jonhgcan43986 жыл бұрын
i was able to do it like that :D thanks for the responses and the help, appreciated very much !!!!!!!!!!!!
@rebekahbottjen78164 жыл бұрын
For some reason this is not working in my project.
@CubicBrain4 жыл бұрын
Make sure, that the Spelling and case of the animation name is correct.
@munzimukhtar7636 жыл бұрын
i get n error line under IsName , i dont know why
@CubicBrain6 жыл бұрын
Hi Munzi, could you be a bit more specific? what does the console say?