We have a series of VG onboarding tasks to show how to tackle different practical use cases using VirtualGrasp in a VR application. In VirtualGrasp SDK, they are packed in VirtualGrasp\Scenes\onboarding.

Task Description

If this video shows "This video is unavailable," please try to refresh the page.

Interaction behaviors wanted

  • We want to close the water bottle with the cap screwed on.
  • We want be able to have bottle-cap system either completely non-physical or physical. That means for non-physical bottle-cap setup, we can’t use Unity’s physical joint support for this assembling task.

Solution

In VirtualGrasp SDK, we packed the solution of this task in VirtualGrasp/Scenes/onboarding.

VirtualGrasp/Scenes/onboarding/VG_Onboarding.unity

Assemble and disassemble cap

VG Assemble setup for cap.
VG Assemble setup for cap.

VG_Assemble component is used for assembling and disassembling the cap to the bottle. Above image shows the setting for the component on cap. And note that the same setting of VG_Assemble works on both physical cap or non-physical cap. A few things to point out:

  • Since when we assemble the cap to the bottle, we want the cap to attach to the bottle as its child, we check Assemble To Parent flag.
  • And Desired Poses is cap_target transform that is the bottle’s child.
  • Since the cap is a rotational symmetric object, so assemble angle threshold just need to make sure its symmetry axis is aligned with desired pose. This axis is represented by the Y Axis of the cap object itself, since Assemble Anchor is not assigned. Therefore Assemble Axis is set to be “Y Axis” to indicate y-axis of the object should match that of cap_target. Since any rotation angle around the axis is fine, Assemble Symmetry Steps is set to be 0.
  • Because when assembled, cap is using revolute joint with non-zero screw rate to simulate screwing effect of cap in the real world, a disabled VG_Articulation with revolute joint is added to this game object and drag it to Assemble Articulation entry.
  • Because when disassembling a cap in the real world, we need to unscrew to loosen it, this requirement is simulated by checking Disassemble On Zero State flag.
  • Because the cap initially is at the disassembled state (floating joint), we don’t need to assign Disassemble Articulation entry.
  • Because the cap initially is at the disassembled state (floating joint), if the object initially is physical, when disassembled it will always recover its physical properties automatically handled by VG. Therefore Force Disassembled Physical flag does not need to be checked.