0c Unity, VRTK, Animation with touch


Use controllers to start animations with touch
*This tutoral works if you have already set up VRTK and SteamVR. See previous VRTK setup tutorial.

In Maya:
Create poly model with animation in its own scene file.

Set the time slider to match the length of the animation.

Choose File->Save As select your
Unity project-> Assets folder

Any animated items should be in separate Maya files. It will be easier to manage.

In Unity:
Select the Maya object in the Assets tab.
Select the Rig Section of the Inspector
     Change Animation Type to Legacy   (The old style of animation is easier to use)

Select the Assets
folder in the Project tab
Drag the Maya object from the Assets list into the Hierarchy tab.

Uncheck Play Automatically in the Animation section of the Inspector

VRTK_1aGrabbable Objects
Select the Maya Object
     Select Window->VRTK->Setup Interactable Object in the top menu
          Select Hold Button to Grab
   (This drops the object when you release the trigger.)
          Hit Setup selected object(s) button
Close the window

Select the Maya object in the Hierarchy tab

     Select Precision Grab
in the Inspector tab (under VRTK_Child of Controller)
     (This lets you grab from the edge rather than the center.)

Select the Maya object in the Hierarchy
Select Add
Component->Physics->  Capsule, Sphere or Box Collider depending on the shape of the object from the Inspector.

VRTK_1aSet up VRTK using touch to start your animation
Select your Maya object in the Hierarchy tab.
Choose Add Component in the Inspector tab
     Search for and add VRTK_InteractableObject Unity_Events
Click on the + button under On Touch
     Drag your Maya object from the Hierarchy tab over to None (Object)
     Select the No Function button and change this to Animation->Crossfade
     Type Take 001 in the box to the right

Hit the Play button to test  unity_play_arrow

Turn off animation while grabbing
Click on the + button under On Grab  (under VRTK_Interactable Object_Unity Events in the Inspector tab)
     Drag your Maya object from the Hierarchy tab
over to None (Object)
     Select the No Function button and change this to Animaton->Stop
(See On Grab image above.)

Demo: (same demo as Unity VRTK Maya from before.)

You can download a sample Maya_VRTK_tutorial.zip and scene file with everything setup here.
     Save to your downloads folder
     On a PC Right click to Extract All...
     Place the Maya_VRTK_tutorial folder on your desktop
     Open the Assets folder
     Double click tutorial.unity

plugins etc included:
     VRTK 3.2.0
     SteamVR 1.2.2
     Unity 2017.3
     Classic Skybox, not the entire set
     CollisionSound.cs by Alex Rickett
     VRScreenRecordingHelper.cs by Alex Rickett
     EasyMouseAndKeyboadVRControls.cs by Alex Rickett to add toh VRTK simulator

**IMPORTANT Save a spare copy of your Maya scene files and Textures in another folder away from your Unity project.