smallarrows.GIF

156 syllabus      site index      3D artists      past student work        DMA

C Unity Maya Interactive Animation VR
Teleport, Throw, and Interact with Animation

In Unity:

Mac Big Sur OS BUG workaround
Download this 2019.4.17 scene, move the folder to your Desktop or working area.
This file is already setup with SteamVR and the SteamVR Emulator.
https://classes.dma.ucla.edu/Winter21/156/projects/generic2.zip
Rename the folder to a new project name.
Start the Unity Hub
     Select ADD
     Locate your renamed project folder
     Click on the project to start
Mac errors: Do not Move any files to the trash, answer preferably Open or Cancel a lot
Save the scene
Quit Unity
Mac: Open System Preferences->Security & Privacy
     Go to General tab
          Unlock the lock with your password
     Click Allow Anyway for any SteamVR apps listed, keep this running, there may be more files to fix.
Restart the Unity Hub
Open the project



Start
Unity Hub
SKIP this section if you used BIG SUR workaround, go to Interact to activate a Maya Animation
Select New
Give your project a name such as
C_Tutorial



Import SteamVR
SKIP this section if you used BIG SUR workaround, go to Interact to activate a Maya Animation
Type SteamVR in the search bar of the Asset Store tab.
(Uncheck Longbow and Samples)

unity_VR_steam_plugin



Add the SteamVR Player Prefab to your scene
Select the SteamVR folder from the Project tab
Select the arrow, open InteractionSystem, open Core, select Prefabs
Drag the Player into the Hierarchy tab



:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Teleporting
Teleporting does not work with the simulator.
Drag in the Teleporting prefab
from SteamVR->InteractionSystem->Teleport->Prefabs->Teleporting into the Hierarchy tab.

Create a floor, GameObject->3D Object->Cube.

Make a Plane for the teleport area. GameObject->3D Object->Plane It should be located above your cube

Add the Teleport Area component to the plane
     Select the plane, use Add Component
          search for tele select Teleport Area
This will allow the player to teleport anywhere along this plane.

Save your scene.

You can now test your scene by selecting the Play arrow.
   unity_play_arrow




:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Interact to activate a Maya Animation

In Maya:
Model an animated poly object

Save the Maya scene file into your Unity project->Assets



In Unity:
Adjust Maya file:
Select the Maya file in the Assets list, select the Model section in the Inspector tab
    
Change the Scale Factor to .3
     Uncheck Import Cameras and Lights
     (Very important for VR, Maya camera interferes with VR camera.)

Switch to the Rig tab in the Inspector on the right.
     Change Animation Type to Legacy  (default was Generic)
     Hit Apply

Switch to the Animation tab
Rename Take 001 to a unique name


Hit Apply

unity_import_scale


Add your Maya File to your scene

Select Assets in the Project tab
Drag your Maya model from the Assets list over to the Hierarchy tab.

Select the
Maya Model in the Hierarchy

     Uncheck Play Automatically in the Inspector



Add Interaction to the Model
Select the Maya Model in the Hierarchy.
    Add Component->Physics->Collider 
     Choose the closest shape.
     You may need to Edit the shape from Edit Collider in the Inspector, because of the animation.

Use Add Component

     Search for inter
     Select Interactable Hover Events
Hit the + under On Hand Hover Begin () in the Inspector

Drag and drop Maya Model from the Hierarchy onto None (obj) in the Inspector

Click the drop down menu reading No function
and choose Animation->CrossFade

Type Take 001 (use the new unique name) in the empty box below

Under Interactable Script
in the Inspector
     Turn off Highlight on Hover

steam_interact_anim


Save
your scene.

You can now test your scene by selecting the Play arrow. Your animated object will start its animation when you touch the object or grab it with a VR trigger.
unity_play_arrow

If you are running in Sim
mode use wasd or the arrow buttons to navigate around the scene,



:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
EXAMPLE

http://classes.dma.ucla.edu/Fall20/156-1/projects/examples/C_activate_animation_player



:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Publish WebGL



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

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.



smallarrows.GIF

© 1988-2021 Jennifer Steinkamp