MyVirtualGrasp is a public script inherited from VG_MainScript, which encodes the main functionality of VirtualGrasp, and is the main component that you need to add and configure in your project to enable VirtualGrasp.
In Unity, VG_MainScript inherits from Monobehavior so you can use it as a component on a GameObject.
On this page, we are going to describe all the major configuration options covered in MyVirtualGrasp.cs.
Avatars and Sensors
VirtualGrasp provides a default avatar model “ThirdParty\VirtualGrasp\Resources\GleechiHands\GleechiRig”. And if you want to use your own model it is supported in the Pro version, see Avatars page.
Specify this to provide a reference to the SkinnedMeshRenderer of the avatar model that you have imported in your scene and which should be controlled by VG during runtime.
Replay and Physical
There are three avatar types in VirtualGrasp (see Avatar Types). By default an avatar is a sensor avatar. If Replay is ticked, the avatar becomes replay avatar (Pro version only). And both sensor and replay avatars can be physical avatars.
VirtualGrasp allows creating multiple avatars in the interface by modifying Size value. In the example image above, we specified to created two avatars, where first one is a sensor avatar, and second one is a replay avatar.
In Unity, VirtualGrasp provides “hand profiles” as ScriptableObjects. You are able to configure a number of hand model-related settings and thereby quickly switch between different custom hands. Besides the original VG_GleechiHands profile you may find some others as part of the VG SDK in Resources/VG_HandPofiles. You can find a more detailed documentation on Hand Profiles.
VirtualGrasp allows you to assign upto two sensors for an avatar, which allows developers to combine two sensors to control avatar’s hands. However in the majority of use cases only one primary sensor is used. Detailed background can be found in Controllers page.
In each Sensor Setup, Profile option allows you to select the “controller profile” for that sensor (primary or secondary). You are able to configure a number of controller-related settings and thereyby allow you to quickly switch between different controller inputs, such as UnityXR (e.g. supporting Quest), LeapMotion, Mouse, and others. A number of common VG_ControllerProfile are part of the VG SDK and you can find them in Resources/VG_ControllerProfiles.
To learn how to create your custom controller profile see Controller Profile.
While each VG_ControllerProfile contains an “Origin Name” that should act as the origin of your controller data, you can overwrite the origin by selecting a different transform here. This may be useful since searching for a GameObject name as the VG_ControllerProfile does is error-prone, for example there may be multiple objects with that name.
If you set an “Origin” here instead, this Transform will overwrite the origin potentially detected through the VG_ControllerProfile. If you do not provide an “Origin” here (set it to None), the selected VG_ControllerProfile will try to find a GameObject by name as described above.
Global Grasp Interaction Settings
After you have setup how your avatar’s hands are controlled, you can use the interface to specify Grasp Button globally for all of the sensors.
You can set the default grasp Interaction parameters for all objects in the scene globally in Global Grasp Interaction Settings. See detailed explanation of the parameters in page grasp Interaction.
|Export Scene in Runtime||Enabling this and running the application will create a vg_tmp subdirectory in your project and save sources that are used for different purposes. (see create debug files)|
|Export Scene in Editor||Alternatively to check “Export Scene in Runtime”, pressing Export Scene in Edit will simulate a launch of the VG plugin from the Unity Editor, thus without the need of launching the scene. This option is provided for convenience, but objects that are not in your scene yet will not be included. (see create debug files)|
|Use Network IDs||(Pro feature) Enabling this will allow you to set network ID for avatar’s left/right hand (through MyVirtualGrasp->Avatar), and set network ID for object (through VG_Articulation).|