Follow

Adding a prop in Unity Live

This article describes how you can add a (custom) prop to your Unity Live workflow.

Scope

Hardware
This workflow is applicable for:

  • Link System
  • Awinda System

Software
This workflow is applicable for:

  • MVN Animate Pro
  • MVN Analyze

Set Prop in MVN
To set up the prop in mvn follow the following tutorial video:
https://tutorial.xsens.com/video/setting-up-props-for-mvn-link


Set up Unity Live stream Plugin
To set up the streaming data from mvn follow the following tutorial video:
https://tutorial.xsens.com/video/streaming-into-unity 


Setup prop in Unity
In the inspector window of the MVN Stream you can select prop 1-4. This will receive prop data from your MVN stream. Select the same prop number as in your MVN stream and select the Type of prop you want to show (standard Sword or Gun). Check if prop is now showing in your scene when you press the play button.  

​​​​

You have now added the basic prop to your Unity Live workflow. To add a custom prop, please continue with the following steps. 

Add an prop option to the prop scripts
In this example a model of a baseball bat is added as a new prop option.
Instead of this step you can use the standard scripts and substitute the model of gun or sword with your custom model. However, this step is recommended for a cleaner workflow. 

Note: in this example "bat" is used. This is interchangeable with other prop names as long as it is maintained throughout the process. 
 
The following changes to these scripts

in the XsProp.cs script
add:

bat 

to:

public enum XsPropType { noProp, gun, sword}

​​
 
In the XsPropManager.cs script
add:  

public GameObject bat;

add:

case XsProp.XsPropType.bat:
                    bat.gameObject.SetActive(true);
                    break;



Import prop model
In the Assets folder under Xsens -> MVN live -> Models you can import your model. This example uses a standard fbx model.



Add prop model
In the Assets folder under Xsens -> MVN live -> Resources, open the "prop" prefab by double clinking it or press "open prefab" in the inspector. 

Add your model to the prop prefab. You can scale it, rotate it to your liking. 
In the Inspector of the "prop" prefab the Xs Prop Manager script is visible. drag the "bat" prefab to the Bat parameter. 

Note: The 0.0.0. position is the position where the prop is attache to the selected segment (in MVN) of the avatar. You can change this position to better align it with your avatar.

​​

Run
In the Inspector of MvnStream, change the type of Prop 1 to "Bat". 
Run the scene and the avatar should now swing a bat. 

​​




Was this article helpful?
0 out of 0 found this helpful
Do you have a question? Please post your question in our Community Forum