Description

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

Avatar and Sensor setup in Unity.
Avatar and Sensor setup in Unity.
In VirtualGrasp we use the term sensor and controller exchangeably since a controller is essentially a sensing device for hand poses.

Avatars

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.

SkeletalMesh

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.

Hand Profile

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.

The physical avatar currently is only semi-physical in that only colliders are added to hand bones, no rigid bodies or articulation bodies are used.

Sensors

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.

Profile

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.

Origin

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

VG global grasp interaction settings.
VG 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.

Note that Interaction Type, Throw Velocity Scale and Throw Angular Velocity Scale can be set locally for each object by attaching VG_Interactable component to the object. These local settings will overwrite the global settings for that object.

Grasp DB

VG grasp database.
VG grasp database

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.

Debug Settings

VG Debug Settings.
VG debug settings.
Parameters Description
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).