AN2016.06 “Using the Skeleton API for use in the Unity game engine”

AN2016.06 “Using the Skeleton API for use
in the Unity game engine”
Nick Leyder
Lead Software Engineer
Yost Labs
Introduction
The PrioVR Dev Kit is a full-body motion tracking suit that uses 19 PrioVR Sensors, a PrioVR
Basestation, and a PrioVR Hub to do so. The PrioVR Sensors are inertial measurement units that give
accurate drift-free absolute orientations of the user’s body. The PrioVR Hub collects the data from the
PrioVR Sensors, and sends it wirelessly to the PrioVR Basestation. The PrioVR Basestation
communicates the received data to the computer over USB. This is shown in Figure 1.
The purpose of this document is to provide an overview of using the PrioVR Dev Kit with the Unity
Game Engine.
Figure 1
Description
Yost Labs provides easy to use drop-in support via a pre-built plug-in for the popular Unity Engine from
Unity Technologies. This makes it possible to create games and simulation applications that take
advantage of Prio's full-body motion control input with very little programming and just a few simple
steps.
(C)2007-2016 Yost Labs
1/8
1. Create a new project in Unity
2. Import a character model.
3. Set the imported model type
4. Add the character to the scene
5. Import the Prio package
6. Add the YostSkeletonRig component the character
7. Setup the skeleton properties
8. Setup a calibration routine
9. Test the game
10. Calibrate the suit
11. Start moving
Step 1: Create a new project in Unity
To create a new project in Unity, click: File → New Project
Step 2: Import a character model
Importing a character model can be done by either dragging the FBX model of a character into the asset
directory or by using the Asset->Import New Asset and browsing to the desired character model.
Step 3: Set the imported model type
After the model has been imported it is necessary to set the model up for humanoid animation.
To do this, go to the import setting and, under “Rig”, set the “Animation Type” to be “Humanoid”.
(C)2007-2016 Yost Labs
2/8
Step 4: Add the character to the scene
To add the character to the scene, simply click and drag the imported character into the scene hierarchy.
(C)2007-2016 Yost Labs
3/8
Step 5: Import the Prio package
To use the PrioVR Dev Kit within the project, the Prio package needs to be imported. The Prio package
allows easy access to the PrioVR Dev Kit functionality with minimal programming.
Import the package by clicking: Assets → Import Package → Custom Package and
selecting the PrioVRPlugin package.
Step 6: Add the YostSkeletonRig component the character
From the imported package click the YostSkeletonRig component script and drag it to the character in
the scene view.
(C)2007-2016 Yost Labs
4/8
Step 7: Setup the skeleton properties
Select the character and set the properties for the suit layout, desired gender, height & age.
This will size the skeleton appropriately and associate the proper suit sensors to the animation
rig.
(C)2007-2016 Yost Labs
5/8
Step 8: Setup a calibration routine
To calibrate the suit for use, a calibration routine must be called before the suit is used in the game. In
this example, the keyboard character 't' is used to trigger the calling of the PrioVR default calibration
routine.
(C)2007-2016 Yost Labs
6/8
Step 9: Test the game
To test the game, press the play button in the development environment.
Step 10: Calibrate the suit
Once the game has started, press the 't' key and then stand in the standard T-pose, with feet together and
arms straight out to the side, until the calibration completes. This should only take a few seconds.
(C)2007-2016 Yost Labs
7/8
Step 11: Start moving
Now the suit has been associated with the in-game character and the suit's movements will be
relayed to the in-game avatar in real-time.
(C)2007-2016 Yost Labs
8/8