Description

VG_Articulation is an internal script that provides the main interface to mark an object as interactable (see object identifiers), as well as to parametrize its object articulation and interactive behavior.

By default, the VG_articulation component sets an object to have floating joint type. If an object is non-physical, constrained (non-floating) joint types can be specified.

VG Articulation
The default VG_Articulation Component (FLOATING joint).

As soon as you change the joint type, the interface will change dynamically.

VG Articulation
VG_Articulation dynamic interface after changing to REVOLUTE joint.

All the parameters are explained in detail in object articulation.

When you want to enable this script, you have to add it on the same GameObject that you want your script to work for.
If you add multiple VG_Articulation components to a game object, only one component can be active and will be used to configure the initial object articulation.
If only an inactive VG_Articulation component is added to a game object, the object will be registered to VirtualGrasp and included in the baking process, however its interactability is temporarily disabled (equivalent to SetObjectSelectionWeight to 0).

Runtime Changes

Regardless of what is the initial setting of an object’s articulation, you can change the object’s articulation parameters in runtime through scripting using the API functions ChangeObjectJoint and RecoverObjectJoint. And these runtime changes are reflected by the current active VG_Articulation component in the Unity inspector.

Example uses can be found in bottle-cap assembling and chain assembling tasks in VG onboarding scene in “VirtualGrasp\Scenes\onboarding”.

ChangeObjectJoint

One of the two ChangeObjectJoint API functions receives an VG_Articulation component as input for the object articulation settings you want to apply.

To do that, you can add a disabled VG_Articulation component to the object, which your script can receive and use as the argument in the ChangeObjectJoint function.

As a result, all the parameters set in the component will be specified in runtime on the object.

RecoverObjectJoint

If you want to recover the object joint to its original parameters, you can call the RecoverObjectJoint API function.

Physical Object Joint Change

A physical object can not have constrained VG joint types (non-Floating type), because VG’s object joint is inherently kinematic. This is why when adding VG_Articulation component to a physical object, only floating type is allowed. In runtime when ChangeObjectJoint or RecoverObjectJoint is called on a physical object to switch joint to non-constrained joint types, VG internally will remove Rigidbody or Articulation Body on this game object, cache the physical properties, and later add them back on when switch back to floating type.