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.
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 hand models. Besides the original VG_GleechiHands profile you may find some others as part of the VG SDK in Resources/VG_HandPofiles.
To read more about hand profiles see VG_HandProfiles.
Replay, Physical and Mirror
By default an avatar is a sensor avatar, meaning that avatar’s hands are directly controlled by the sensors for movement and object interaction. This is also the avatar used for recording sensor data (feature available in Pro version).
If the Replay option is ticked, then the avatar will be registered as a replay avatar. The hands of this avatar will be controlled by pre-recorded sensor data. Note this sensor record and replay feature is only available in VirtualGrasp Pro version.
Both sensor avatar and replay avatar can be created as a physical avatar if Physical option is ticked.
Only sensor avatar can be specified to have mirror hand control if Mirror option is ticked. When mirror hand control is enabled, the controller/sensor signal from a user’s left hand side will be used to control avatar hand of the right side, vice versa.
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, the Profile option allows you to select the “controller profile” for that sensor (primary or secondary). You are thereby able to drag & drop a number of controller-related settings and thereyby quickly enable or switch between different controller inputs, such as UnityXR (e.g. supporting Quest), LeapMotion, Mouse, and others. A number of common VG_ControllerProfiles are already part of the VG SDK and you can find them in Resources/VG_ControllerProfiles.
To read more about controller profiles see VG_ControllerProfiles.
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.
Once you have baked grasps for your current project using VG_BakingClient, the saved grasp db can be dragged into Grasp DB entry to be utilized.
|Export EC DebugDraw
|Enabling this will show the raw sensor skeleton of the external controller data that the hand(s) are using. This is useful if you are creating or debugging controller data.
|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).