Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Tap to initiate animation

Discussion in 'VR' started by mergatroid, Jun 10, 2017.

  1. mergatroid

    mergatroid

    Joined:
    Apr 23, 2017
    Posts:
    5
    Hello all, I have created a scene in 3ds max that contains animation. I have baked this onto the model and imported into Unity as a FBX. I have successfully deployed the scene to my HoloLens however the animation auto plays. What I would really like to do is to allow the user to use the gesture commands to initiate the animation. Please can somebody let me know what needs to be done? I am a complete coding noob so please bare with me.
     
  2. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    Here is the documentation on the code for the gesture recognizer :
    https://docs.unity3d.com/ScriptReference/VR.WSA.Input.GestureRecognizer.html

    This is were I would start:
    -Turn off autoplay on the model animation
    -Create a new C# script for the gesture recognizer code
    -Create a new gesture recognizer in the start function of the script
    -Add the event for Tapped and the delegate for the event
    -In the delegate event for OnTapped get the model and start the animation
     
    mergatroid likes this.
  3. mergatroid

    mergatroid

    Joined:
    Apr 23, 2017
    Posts:
    5
    Many thanks for the response. I can't where to turn off autoplay on the animation, I have an option for 'loop' but that is about it.
     
  4. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    I think it is play on awake