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 be able to use a screw driver to assemble two screws onto a screw-box (a box with two screw holes).
  • Basically we can form a chain of objects: screw-box –> screw –> screw driver, with “–>” pointing to the child.

Solution

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

VirtualGrasp/Scenes/onboarding/VG_Onboarding.unity

Assemble and disassemble screw driver to screws

VG Assemble setup for screw driver.
VG Assemble setup for screw driver.

VG_Assemble component is used for assembling and disassembling the screw driver to the head of screw. Above image shows the setting for the component on the screw driver. A few things to point out:

  • Since when we assemble the screw driver to the screw, we want the driver to attach to the screw as its child, we check Assemble To Parent flag.
  • Since we have 2 screws, 2 Desired Poses tool_anchor_target transforms are assigned, and each is a child of one of the two screws.
  • Since the screw driver is a rotational symmetric object, so we just need to make sure its symmetry axis is aligned with desired pose. This axis is represented by the Z Axis of the Assemble Anchor on the driver. Therefore Assemble Axis is set to be “Z Axis” to indicate z-axis of the anchor should match that of tool_anchor_target. Since any rotation angle around the axis is fine, Assemble Symmetry Steps is set to be 0.
  • Because when assembled, the screw driver is to be fixed on the screw head, so we don’t need to assign Assemble Articulation entry since by default assembling switches the object joint to the fixed joint type.
  • Because the screw driver initially is at the disassembled state (floating joint), we don’t need to assign Disassemble Articulation entry.
  • Because the screw driver 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.

Assemble and disassemble screws to screw box

VG Assemble setup for screws.
VG Assemble setup for screws.

VG_Assemble component is also used for assembling and disassembling the screw to the screw box. Above image shows the setting for the component on each of the two screws. A few things to point out:

  • Since when we assemble the screw to the screw box, we want the screw to attach to box as box’s child, we check Assemble To Parent flag.
  • And there are two Desired Poses screw_target1 and screw_target2 transforms that are children of the screw box.
  • Since the screw is a rotational symmetric object, so we want to make sure its symmetry axis is aligned with desired pose. This axis is represented by the Z Axis of the screw object itself, since Assemble Anchor is not assigned. Therefore Assemble Axis is set to be “Z Axis” to indicate z-axis of the object should match that of the two screw targets. Note the head of the screw is a hexagonal prism shape, the screw is a “6-step rotational symmetric”, therefore Assemble Symmetry Steps is set to be 6.
  • Because when assembled, the screw is using revolute joint with non-zero screw rate to simulate screwing effect 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 screw in the real world, we need to unscrew to loosen it, this requirement is simulated by checking Disassemble On Zero State flag.
  • Because the screws initially are at the disassembled state (floating joint), we don’t need to assign Disassemble Articulation entry.
  • Because the screws initially are 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.