0b Unity Maya Background Animation

smallarrows.GIF

In this tutorial we will create animations in Maya that run continuously in the background in Unity.

In Unity:

Start Unity
(You may need to set up an account.)
Select NEW

Give your project a name such as Maya_Anim1_Tutorial. This will create a folder with folders inside.
Save to your external hard drive or the Desktop.
Select 3D.
Select Create Project.

(If there is a Services tab, right mouse over the tab, select Close Tab.)


Import SteamVR SDK Assets

Choose Window->Asset Store

Type SteamVR in the search bar
unity_VR_steam_plugin
Select the
SteamVR Plugin by Valve  (It is free)
Choose Import twice (Ignore errors, select I made a backup go ahead)
Choose
Accept All and OK

Put the main view window back to Scene instead of Asset Store

Select the SteamVR folder from the Project tab, Select the arrow, select Prefabs
Select the CameraRig
In the Inspector tab
change Size to Calibrated, this uses the calibrated area from the headset


Setup the Main Camera to be used later
Select the Main Camera from the Hierarchy tab
     Change Target Display to Display 2

     Change Target Eye to None in the Inspector tab
(The main camera interferes with the Vive camera if you do not do this.)



In Maya: Model a room with some animated objects
Create poly models for items in your VR environment. (NURBs do not work)
(NOTE) In Unity, use GameObject->3D Object->Cube for your floor, this will make things easier. The floor should be at 0 in the Y axis. Avoid planes for floors, collisions will not work with planes, you need a volume.


If you have any texture maps place them in your Unity project-> Assets folder
Assign any textures from inside Maya, using the images inside your Unity project Assets folder.

Save the Maya scene file into your Unity project-> Assets
You will see your models and textures appear automatically in Unity.

Any animated items with different timing or that will be interacted with should be separate Maya files. It will be easier to manage.
You may need to bake certain animations that do not transfer into Unity, such as most deformers and Ncloth, etc.
Basic IK rigging and blend shapes will transfer.

(Maya does have a utility to send files straight to a Unity project, it saves as an FBX, the scale is completely wrong. Don't use.)

See the Table Lamp tutorial if you want to know how to set keyframes for animation.



In Unity: Add your Maya File to your scene
Select Assets in the Project tab
Drag your Maya file from the Assets list over to the Hierarchy tab.

If your object is the wrong scale do this:
Select the Maya file in the Assets list, select the Model section in the Inspector tab, change the Scale Factor, hit Apply
Scale: In general the classroom active area is about 15 x 10 x 11.25 units xyz in Maya, this will match the Vive scale is you scale by .3. Of course you can make your model any size and you will be able to teleport around.
VRCollisions_1


Create an Animator Controller:
*The Animator Controller allows you to arrange and maintain a set of animations for a maya scene, as well as transitions between the different animation states.

Top menu bar  Assets-> Create-> Animator Controller re-name it

Select the object that has the animation from the Hierarchy window

In the Inspector, Animator should be checked

Click the small round circle to the right of Controller, select the controller you just added.  unity_dot
unity_link_anim_controller



Set up an Animation State:
In the Project tab select Assets
Double click on the Animation Controller in Assets, the Animator tab should pop up.

To navigate inside the Animator Tab, Hold middle mouse button and drag on the grid.


VRCollisions_4



Open up the little arrow next to the animated object in the
Assets folder  unity_asset_arrow
Drag the Animation Take 001 into the Animator tab onto the grid.
unity_drag_take001_controller




Loop
If you would like to loop your animation:
Select the object that has the animation from the Assets window
Change to the Animations section of the Inspector tab
Check Loop Time
Hit Apply


Now your animations are all set up to run continuously.




:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Testing without the Vive
Hit the Play button   unity_play_arrow
Change to Display 2 in the Game window.  (The Vive is using Display 1)

If the camera view does not look right, Make sure Scale is 1x in the Game window.

You can position this camera using the Scene view when the Game is not running.



:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Try your Project with Vive
Start the Steam program from Desktop:
Select the VR button

Hit the Play button   unity_play_arrow

Answer
Accept All in the Steam VR plugin
popup window

Turn on the hand held controllers, put on the headset



:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
If the Vive VR is not working:
Make sure the headset and controllers are connected
Try wiggling the Headset and pressing the buttons on the controllers
Make sure the hand held controllers have charged batteries
Make sure SteamVR status utility is running
     Start Steam  unity_steam_logo
     Login
     Hit this logo in the upper right of the steam window, you can close the large window  start_steam_VR
     Ignore Display and Base Station warnings, it will work.
    
unity_steam_status
Steam Status Utility will look like this if it is ready.

Reset Steam if you don't see all the icons
     Select the down arrow next to SteamVR unity_steam_arrow
     Select Devices->Reboot Vive headset
     There is also a menu to Run Room Setup, this should be done already



:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
OBS
OBS screen capture VR documentation

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

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