Touch screen, clicking objects on screen with Vuforia AR & Unity3D (Ray-casting in AR)

Поділитися
Вставка
  • Опубліковано 8 лют 2025

КОМЕНТАРІ • 134

  • @NGONeverGetOldPT
    @NGONeverGetOldPT 6 років тому +53

    Great video, thank you!
    The code for the future devs:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class soundCon : MonoBehaviour {
    public AudioClip[] aClips;
    public AudioSource myAudioSource;
    string btnName;
    // Use this for initialization
    void Start () {
    myAudioSource = GetComponent();

    }

    // Update is called once per frame
    void Update () {
    if (Input.touchCount > 0 && Input.touches[0].phase == TouchPhase.Began)
    {
    Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
    RaycastHit Hit;
    if (Physics.Raycast(ray, out Hit))
    {
    btnName = Hit.transform.name;
    switch (btnName)
    {
    case "myButton1":
    myAudioSource.clip = aClips[0];
    myAudioSource.Play();
    break;
    case "myButton2":
    myAudioSource.clip = aClips[1];
    myAudioSource.Play();
    break;
    case "myButton3":
    myAudioSource.clip = aClips[2];
    myAudioSource.Play();
    break;
    case "myButton4":
    myAudioSource.clip = aClips[3];
    myAudioSource.Play();
    break;
    case "myButton5":
    myAudioSource.clip = aClips[4];
    myAudioSource.Play();
    break;
    case "myButton6":
    myAudioSource.clip = aClips[5];
    myAudioSource.Play();
    break;
    default:
    break;
    }
    }
    }

    }
    }

  • @funjay9559
    @funjay9559 4 роки тому +4

    This is what I’ve been looking for for hours. OMG. thank you

  • @deicide2324
    @deicide2324 3 роки тому +6

    For those who is not able to work with this code.
    You need to add a collider to the object, my suggestion is use the Mesh Collider and enable the Convex.

  • @WhimsyCottage
    @WhimsyCottage 4 роки тому +6

    This helped me alot with a schoolproject.
    Thank you!

  • @MsCoffeeFellow
    @MsCoffeeFellow 6 років тому +1

    thank you so much for this tutorial @CubicBrain, it's so detailed but simple and functional as hell. you've really made my day.

    • @CubicBrain
      @CubicBrain  6 років тому +1

      Emina Dizdarevic thanks a lot for the great feedback.

  • @nammonjv
    @nammonjv 3 роки тому

    This video saved my life, thanks a lot 😭

  • @freebacer
    @freebacer 5 років тому

    Exactly what I was needing. Thankyou Very Much!!!!!!

  • @master_zeec
    @master_zeec 7 років тому +2

    Wow, this is amazing, great work

    • @CubicBrain
      @CubicBrain  7 років тому

      Thanks a lot. Glad you like it.

  • @Annefree98
    @Annefree98 2 роки тому +1

    Nice video!! Don't forget to remove your Main Camera, otherwise it gives the error that there are 2 audio listeners in the scene.

  • @adilahizzatihs9672
    @adilahizzatihs9672 2 роки тому

    Thank you very much Sir for this tutorial

  • @pauldouglas6931
    @pauldouglas6931 6 років тому +1

    Fantastic tutorial video. Thanks so much! ;)

  • @joseph9227
    @joseph9227 3 роки тому

    Thank you very much for this tutorial :)

  • @3mr0y
    @3mr0y 5 років тому +1

    thanks a lot its very helpful for me

  • @pyrotaze
    @pyrotaze 6 років тому +1

    Great tutorial! Keep up the good work :)

  • @AiniMazalan
    @AiniMazalan 4 роки тому

    Thank you

  • @tegarbrawijaya
    @tegarbrawijaya 9 місяців тому

    does the button have to be inside the marker? or the markers function for mark only

  • @bryanbarrios5535
    @bryanbarrios5535 5 років тому +1

    Thank you!

  • @billywdyt
    @billywdyt 2 роки тому

    how about without image tracking or markerless ar?

  • @cebkun
    @cebkun 3 роки тому

    Great video ! Hi, how to setup using the mouse click?

  • @giancarlomoran2730
    @giancarlomoran2730 3 роки тому

    Hey, can you show something like this, but when you click on the object, a video pops up and starts playing?

  • @sameraswise3227
    @sameraswise3227 4 роки тому

    Thank you for this good video.. Can I add the object and audio in the same scene .. I mean when I but the card will appear the 3D object and audio or video

  • @Jjolasman
    @Jjolasman 6 років тому +2

    It works ;) thanks ;)

    • @Jjolasman
      @Jjolasman 6 років тому

      However, the OnMouseDown function does the work too

  • @alashchanneltv3387
    @alashchanneltv3387 3 роки тому

    bro? How you does enable the touches with circles? I need to add this touch effects to my AR project. Please help me?

  • @slujan01
    @slujan01 6 років тому

    Work ;)
    Nice !!!!

  • @mehrdaddarafshi860
    @mehrdaddarafshi860 2 роки тому

    Could u do the same process also for Area target objects? I wanna creat an AR game and want to add sound and animation script to different objects in my scene where I use vuforia Area targets. If yes how?

  • @benjamonrarira8704
    @benjamonrarira8704 6 років тому +1

    hi can i get help with the android input or raycast mouse input plz

  • @sudahmalam1
    @sudahmalam1 7 років тому +1

    thanks dude,..

  • @muhammadtalhaali2541
    @muhammadtalhaali2541 5 років тому +1

    I need help sir on how to open links with button click or object tap and dial mobile numbers :/

  • @seanmarkovic2654
    @seanmarkovic2654 6 років тому +2

    Is it possible to make a button press open a URL? I've been trying to figure out how to do this but I can't find any information online regarding this on mobile devices

    • @CubicBrain
      @CubicBrain  6 років тому +2

      should be possible with: public static void OpenURL(string url). docs.unity3d.com/ScriptReference/Application.OpenURL.html

    • @1917revolution
      @1917revolution 4 роки тому

      Hi Sean! Were you able to do it? I'm trying to do just the same as you, but I'm not being able.

  • @SsjDennis
    @SsjDennis 4 роки тому

    Hi, I hope you see this, since the vid. Is a bot older
    How can I code, so that when I click on an object, another Object (my UI panel) opens?
    + I want to open a different UI panel for each object I click on.
    Thanks for taking your time :)

  • @itsmezyvin
    @itsmezyvin 5 років тому

    Why the script not working in unity5? I confuse about calling btnName.

  • @vivins3215
    @vivins3215 5 років тому

    A clips is not showing for me

  • @alimmalik5846
    @alimmalik5846 5 років тому

    Great video. can you help me?
    how the script is made if when cube is pressed, the object will appear and only focus on that object after cube is pressed

  • @PEDRO4075
    @PEDRO4075 3 роки тому

    Hi! Can you help me on how to make different objects appear for each side of the Vuforia Multi-Image target? Imagine a multi-target cube, I want to place different objects for each face

  • @xc5838
    @xc5838 5 років тому +2

    Hi can you please explain how to do raycasting with animation?
    Do I need to put myAnimationSource = GetComponent(); in void Start(), and then call
    case "object_1":
    myAnimationSource.Play("animation_001");
    break;
    in this case?

    • @CubicBrain
      @CubicBrain  5 років тому

      Hi Luke, I was just working on a project that uses the exact code from this example, but with animation instead of sound. yYou are completely correct, however you don't have to get the component in start, as you are just looking for generic hits, and checking for the name of the objects. so, a "public Animator anim;" to begin with to get the animator of the object you want to animate, and then just "case "myButton1": anim.Play("your animation name"); break;"

    • @xc5838
      @xc5838 5 років тому

      @@CubicBrain I posted my code below. Unfortunately, it does not work. I have followed your other tutorial for triggering animation with touch only which works great, but it triggers animations for all objects at once. This is why I want to use raycasting to trigger individual animations. Anyways thanks for the help. I really appreciate it. If you see something wrong with the code please tell me. I really want to get this working :D

    • @CubicBrain
      @CubicBrain  5 років тому

      hi, Your code seem fine. Have you added the animator for the object you want to animate to the script in the inspector? also, make sure that all the names are correct (also capitalization)

    • @xc5838
      @xc5838 5 років тому

      @@CubicBrain i.imgur.com/ONXSmTC.png
      My current script is derived from your other tutorial with touch/keyboard animation but with no raycasting. Would it help if I try to get this working with keyboard input first?

    • @CubicBrain
      @CubicBrain  5 років тому

      Hi Luke, If you want to hit a specific 3D object on screen (on a touch device) you need to use raycasting. otherwise it wont know where you are clicking. a canvas UI might not need raycasting, but then it would be stuck to your screen.

  • @BlunderBoyNehruJ
    @BlunderBoyNehruJ 5 років тому +1

    actually i want make a pop out description in my AR app can anybody help me out with that thing eg when i'll touch on characters head it will give me description about like what is head how many veins that character ahs in that head all that stuff

  • @bhavanidevi326
    @bhavanidevi326 5 років тому

    I did all, the output came exactly but audio was not playing we I click the button help me??

    • @marthaatdarumatech5381
      @marthaatdarumatech5381 5 років тому

      I have the same situation when I built it for an iOS device, but it works fine in a Android device. Try Android!

  • @maadhavpatel2621
    @maadhavpatel2621 4 роки тому

    Hey , do you have idea about how to make ar app with groundplane detection for non-arcore devices

    • @CubicBrain
      @CubicBrain  4 роки тому

      Hi, I think AR foundation in Unity might have it. otherwise unitys project mars might work: unity.com/products/unity-mars

  • @wuimingleebarroga8629
    @wuimingleebarroga8629 5 років тому

    hi, if i just want to touch an object to show a text above the object, may i know how to do it? How would the script be like? Can you help me ?

    • @wuimingleebarroga8629
      @wuimingleebarroga8629 5 років тому

      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class clickObject : MonoBehaviour
      {
      public GameObject addText;

      void Update()
      {
      if (Input.GetMouseButtonDown(0))
      {
      RaycastHit hit;
      Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
      if (Physics.Raycast(ray, out hit, 100.0f))
      {
      if (hit.transform.gameObject != null)
      {
      buttonClicked(hit.transform.gameObject);
      }
      }
      }
      }
      public void buttonClicked(GameObject gameObject)
      {

      addText.SetActive(true); // show 3D text
      }
      }
      Sadly it did not work when click on the AR object . Can you help me?

    • @rosannarifino9337
      @rosannarifino9337 4 роки тому

      @@wuimingleebarroga8629 sorry, how did you do after?

  • @zilehumakhan8343
    @zilehumakhan8343 6 років тому

    Hi, I am trying to make a virtual button which on click should show me the 3D plane in the Augmented Reality, It seems not be working for me. Someone, please help

  • @JosueAbraham
    @JosueAbraham 6 років тому

    How can I make a botón that stops the audio of other buttons and play other audio at same time ? the intention is to avoid that the sounds are not over lapping. tanks for the tutorial.

    • @CubicBrain
      @CubicBrain  6 років тому

      Hi Josue, you can stop the individual audio sources, or stop all at the same time. the code is just Audio.Stop();, but if you want all to stoop, you have to identify them, stop them, and then play the next. the stop all script could look something like:
      void StopAllAudio() {
      allAudioSources = FindObjectsOfType(typeof(AudioSource)) as AudioSource[];
      foreach( AudioSource audioS in allAudioSources) {
      audioS.Stop();
      }
      }

  • @vedantraopoly2400
    @vedantraopoly2400 5 років тому

    How do I detect a raycast on a child object?

  • @SkullKrusher017
    @SkullKrusher017 2 роки тому

    does it work on iOS

  • @msahkoo
    @msahkoo 6 років тому

    i can't understand after 7:14, i build it for android phone but it doesn't work. please make detailed video after 7:14. I am beginner in AR.

  • @rosannarifino9337
    @rosannarifino9337 4 роки тому

    Why, when I press the cube in play with the mouse, nothing happens? Can someone help me, please?

    • @CubicBrain
      @CubicBrain  4 роки тому +2

      Hi Rosanna, this won't work with mouse click, as it's only registering touch input. You could look at this unity doc for the mouse version: docs.unity3d.com/ScriptReference/Input-mousePosition.html

    • @rosannarifino9337
      @rosannarifino9337 4 роки тому +1

      @@CubicBrain thank you so much and really great video 👍

  • @farahilyanah.1633
    @farahilyanah.1633 5 років тому

    can we do this using unity personal?

  • @lilicafaray8423
    @lilicafaray8423 3 роки тому

    i'm having some hiccups T.T mine won't work, but I use a custom made 3D character and I don't know what to do

    • @CubicBrain
      @CubicBrain  3 роки тому +2

      You might need to add a collider to your model, and match the name og that model to the button name. If that does not work, you can create a cube and make your model a child of that cube. Then just remove the mesh rendere for the cube.

    • @lilicafaray8423
      @lilicafaray8423 3 роки тому

      @@CubicBrain thank you. The collider worked

  • @MarioSasuke626
    @MarioSasuke626 6 років тому

    Hi!, thank you so much bro, this video helped me so much but i have a question and i hope you can help me, the sounds that i used are longer so i need to stop them when tracking lost, so if u can help me with that i would apreciate it!

    • @CubicBrain
      @CubicBrain  6 років тому

      Hi, thanks. You should be able to use the tracking lost function:
      private void OnTrackingLost()
      {
      audio.Stop();}

  • @TheMobyh
    @TheMobyh 6 років тому +1

    I get very high lag between when I touch a cube and when the sound plays (about a second) also when I press several cubes in quick succession there's audio issues

    • @diegoreyes3851
      @diegoreyes3851 4 роки тому

      do u fix it?

    • @TheMobyh
      @TheMobyh 4 роки тому

      @@diegoreyes3851 I did, but I honestly can't remember how. I had help from a CS professor from my uni and it was over a year ago :( I don't even have the file anymore

  • @warek123456789
    @warek123456789 6 років тому

    Hello, I have problem with this. I did everything, my scripts it's similar but when I want click nothing play. Can you help me? I have vuforia 7.2.20, when I click on the screen, nothing happens

    • @israelgallegos9176
      @israelgallegos9176 6 років тому +1

      i have the same problem :(, helppppp!

    • @warek123456789
      @warek123456789 6 років тому

      You need add to ARcamera Raycast :) I did this and is ok

    • @jmb5306
      @jmb5306 6 років тому

      Hi, I have the same problem with Unity 2018.2.1.7f1 and Vuforia 7.5.26!
      ARcamera Raycast??? IAm a newbie, where to find this option or asset/Package? I did not find in Unity or Google Thx

  • @JoshuaMartinez-hu5bg
    @JoshuaMartinez-hu5bg 6 років тому +1

    Hello, I added the following code in the Update method to enable testing the buttons in the Editor, but apparently it is not possible to click on the buttons when the piano image is recognized and the buttons appear. Is it indeed the case or is there something missing in my code?
    #if Unity_EDITOR
    if ( Input.GetMouseButton(0) )
    {
    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    RaycastHit hit;
    if ( Physics.Raycast(ray, out hit) )
    {
    _buttonName = hit.transform.name;
    switch (_buttonName)
    {
    case "Button1":
    _audioSource.clip = _KeysSoundClips[0];
    _audioSource.Play();
    break;
    case "Button2":
    _audioSource.clip = _KeysSoundClips[1];
    _audioSource.Play();
    break;
    case "Button3":
    _audioSource.clip = _KeysSoundClips[2];
    _audioSource.Play();
    break;
    default:
    break;
    }
    }
    }
    #endif

    • @CubicBrain
      @CubicBrain  6 років тому +1

      Hi Joshua. I just tested your code in my project, and it works fine. (I just had to convert the naming to fit my project). Maybe the naming of your buttons is off? In regards to your test code here; This will disregard the "beginning of a mouse press, and just play over and over again if you hold the mouse button pressed (just a note).
      Here you have a c/p of my code:
      if (Input.GetMouseButton(0)) {
      Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
      RaycastHit hit;
      if (Physics.Raycast(ray, out hit)) {
      btnName = hit.transform.name;
      switch (btnName) {
      case "myButton1":
      myAudioSource.clip = aClips[0];
      myAudioSource.Play();
      Debug.Log("btn1");
      break;
      case "myButton2":
      myAudioSource.clip = aClips[1];
      myAudioSource.Play();
      Debug.Log("btn2");
      break;
      case "myButton3":
      myAudioSource.clip = aClips[2];
      myAudioSource.Play();
      Debug.Log("btn3");
      break;
      default: break; }
      }
      }
      As you can see my code is the same as yours I just added the debug log so that I would get some feedback in my console.

    • @JoshuaMartinez-hu5bg
      @JoshuaMartinez-hu5bg 6 років тому

      Thanks for your quick reply. I included the Debug statements and, unsurprisingly, they do not print anything to the console. Let me get something straight: You run the program in editor, put up the image marker, and when the buttons appear on the game view, you try to click on them with the mouse. Right? Or am I doing it wrong when testing it in editor?
      This is the tutorial that taught me how to process input mouse clicks, so I learned the mouse position input processing from here (ua-cam.com/video/tKX5KRFbGn4/v-deo.html) though the difference of course is that this is a regular Unity program but what I am trying to do is a Vuforia program where the buttons appear when image recognition succeeds and so the buttons move with the image, etc... I would appreciate your thought, so I can get this done. Thanks

    • @CubicBrain
      @CubicBrain  6 років тому +1

      Hi Joshua, yes, I have the script attached to the image target, and then I just "scan" the image target with the webcam and click the cubes in the game view with my mouse. Did you check the naming of your buttons?

    • @JoshuaMartinez-hu5bg
      @JoshuaMartinez-hu5bg 6 років тому

      Yes, I did. It's strange... Do you think "distance" from the webcam might be an issue? I tried it, to no avail. Is there a script somewhere that deals with distance from the image target to the webcam or device cam?

  • @francesm2582
    @francesm2582 6 років тому

    Hi! I wonder if is it possible to switch scene whenever I press the button? How can I do that? Thanks

    • @CubicBrain
      @CubicBrain  6 років тому

      Hi Frances. It should be possible with the scene loader. try something like: SceneManager.LoadScene("OtherSceneName", LoadSceneMode.Additive);

  • @1917revolution
    @1917revolution 4 роки тому

    Hi Cubicbrain!
    I'm trying to do something similar, but opening a url when clicking a 3D object. I'm trying to mix this script with another one (at the end of the comment) seen on another video, but I've been unable till now. You know if there is any tutorial anywhere or, if it's something easy, could you give me a hint? Thank you so much!
    public class UrlOpener : MonoBehaviour
    {
    public string Url;
    public void Open()
    {
    Application.OpenURL(Url);
    }
    }

  • @willy3076
    @willy3076 6 років тому

    Hi I'm trying this and I have some problem. I use Mapbox instead of Vuforia. Is it can't working?
    I do with your script, but I touched the objects on screen and it didn't respond. I also use the Debug to check the problem, but it stop at If before. How to solve this problem?
    Thank you so much.

    • @CubicBrain
      @CubicBrain  6 років тому

      Hi, i'm not sure how mapbox handles the camera, but the approach should be kind of the same. at it's core it's just the raycasting from the camera that triggers the sound.

  • @pimrumpanoithammaraj6373
    @pimrumpanoithammaraj6373 6 років тому

    Hi I built it in IOS and it didn't work. Is it has to build only in Andriod phone?

    • @CubicBrain
      @CubicBrain  6 років тому

      Hi Pimrumpa. I havn't tried building it to a apple device (as I do not own one). however it should also work on iOS.

    • @pimrumpanoithammaraj6373
      @pimrumpanoithammaraj6373 6 років тому

      Everything was appeared except sound :( Thank you for this dope tutorial tho!

  • @anshuman1964
    @anshuman1964 6 років тому

    i am new to all this , just a quick question , is it possible to create a button in some space / in front of you (not on a specific spot or a picture ) . is it possible please help.

    • @CubicBrain
      @CubicBrain  6 років тому

      Hi, Yes and no. Vuforia which I use here always needs a marker (picture) to track. this means that it will only function and activate if you have the pre-configured image/picture in front of the camera. if you want to track your surroundings without a marker, you would need ARCore, ARKit, og use Unitys AR foundation. this will track any flat surface.

  • @yansen1207
    @yansen1207 6 років тому

    Hi does this work with virtual button?

    • @CubicBrain
      @CubicBrain  6 років тому

      Hi, Yes, but as far as I know virtual buttons are not on screen clickable.

    • @AkshayBharwani
      @AkshayBharwani 6 років тому

      I made a similar app, and added normal UI buttons which were clickable through the screen. Without Ray Casting.
      Just normal button.
      Have you tried that?

  • @M3CH5OUL
    @M3CH5OUL 4 роки тому

    First off, these videos are great! I am learning a ton. I do have a question...
    Can anyone show me how to activate the animator triggers that belong to the other game objects? For example, if I press Button 1, Cube 1's "Roll" trigger is activated, and Cube 2&3's "Jump" triggers are activated.

    • @CubicBrain
      @CubicBrain  4 роки тому +2

      Hi, Thanks a lot. you can reference the other gameobjects Animator in your script. here is a script that might work for you:
      public class makeCubeSpin : MonoBehaviour
      {
      //reference the specific cube or gameobject in the inspector
      public Animator cubeAnimator;
      void Update()
      {
      if (Input.GetKeyDown("1"))
      {
      //Play the animation clip named "cubeAnimation"
      cubeAnimator.Play("cubeAnimation");
      }
      }
      }

    • @M3CH5OUL
      @M3CH5OUL 4 роки тому +1

      @@CubicBrain Yes!!! Thank you so much! I'll post the end result once it's ready.

  • @Cherimoya2
    @Cherimoya2 5 років тому

    In theory, this should work with ARFoundation? Can anyone answer this.

    • @CubicBrain
      @CubicBrain  5 років тому

      Hi, Well i should, however I haven't tested it. but the setup is similar.

  • @judge55555
    @judge55555 6 років тому

    Is it possible to use this to trigger animations?

    • @CubicBrain
      @CubicBrain  6 років тому +1

      Hi Juan, Sure. you just have to play the specific animation in the animator. One of my other videos might help you: ua-cam.com/video/N73EWquTGSY/v-deo.html

    • @judge55555
      @judge55555 6 років тому +1

      CubicBrain thanks. I'll check that out. It's hard being new at being a developer that does not know code hahaha.

    • @CubicBrain
      @CubicBrain  6 років тому +1

      sure. let me know if you run into trouble.

    • @judge55555
      @judge55555 6 років тому

      CubicBrain thank you very much!

    • @judge55555
      @judge55555 6 років тому

      do you have discord by any chance? or better a server in discord?

  • @JoshyHJoshy
    @JoshyHJoshy 6 років тому +4

    Hi there, Is it necessary to have the AudioSource variable as public and then drag & drop the ImageTarget game object onto its public field, so that the AudioSource component can be extracted and assigned to the slot? The AudioSource component is already attached to the ImageTarget game object, so why not just make it private and in the Start method, use GetComponent() in code? Would that not get the AudioSource component?

    • @CubicBrain
      @CubicBrain  6 років тому +2

      Hi, strictly speaking no, You don't have to reference the AudioSource. However if the script was/is on another gameobject (like a gameController on an empty GameObject) it would be necessary.

  • @noelkonagai1100
    @noelkonagai1100 6 років тому

    Hi! I was wondering how you got the circle touch feedbacks? Was it a script?

    • @CubicBrain
      @CubicBrain  6 років тому +1

      Hi Noel. Thats just my screen recorder making those.

  • @miguelmascarenhas613
    @miguelmascarenhas613 5 років тому +2

    0 dislikes damn that s rare

  • @HanaShoib
    @HanaShoib 6 років тому

    Hi, what if you want to do something other than play a bit of audio, what if I want some text to pop up for example?

    • @CubicBrain
      @CubicBrain  6 років тому

      Hi Hana. Then you just have to add the specific call in the switch case. like ex. if you have an animation component, then you could start an animation by writing: anim.Play("spinAnimation").

    • @HanaShoib
      @HanaShoib 6 років тому

      CubicBrain ahh and I'll have to create that animation externally? As in - within the unity environment?

    • @CubicBrain
      @CubicBrain  6 років тому

      you can create some simple animations within Unity, but thats primarily position, scale and rotation. external animation applications will be able to do a lot more. regarding loading and triggering the animation, you can watch my Unity trigger animations video (the one with FBX uses externally created animations)

    • @HanaShoib
      @HanaShoib 6 років тому

      I see. do you have any tutorial on something like that that I can refer to? : )

    • @CubicBrain
      @CubicBrain  6 років тому

      not regarding creating animations in external programs, but the setup and triggering, you can refer to this tutorial: ua-cam.com/video/N73EWquTGSY/v-deo.html

  • @fahadrahman4428
    @fahadrahman4428 6 років тому

    How can an animate an object using these buttons?
    Here is the code what I've been doing so far.
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine.SceneManagement;
    using UnityEngine;
    public class soundcon : MonoBehaviour {
    public AudioClip[] aClips;
    public AudioSource myAudioSource;
    string btnName;
    public Animator anim;
    // Use this for initialization
    void Start () {
    myAudioSource = GetComponent ();
    anim = GetComponent ();
    }
    // Update is called once per frame
    void Update () {

    if (Input.touchCount > 0 && Input.touches [0].phase == TouchPhase.Began)
    {
    Ray ray = Camera.main.ScreenPointToRay (Input.GetTouch (0).position);
    RaycastHit Hit;
    if (Physics.Raycast (ray, out Hit))
    {
    btnName = Hit.transform.name;
    switch (btnName)
    {
    case "myButton1":
    anim.Play ("point");
    myAudioSource.clip = aClips [0];
    myAudioSource.Play ();

    break;
    case "myButton2":
    SceneManager.LoadScene (0);
    break;
    default:
    break;
    }
    }
    }
    }
    }
    Thanks in advance :)