Guides
Guides

VRTK_RotatorTrackGrabAttach

extends VRTK_TrackObjectGrabAttach

Overview

Applies a rotational force to the grabbed Interactable Object.

The Interactable Object is not attached to the grabbing object but rather has a rotational force applied based on the rotation of the grabbing object.

Script Usage:

  • Place the VRTK_RotatorTrackGrabAttach script on either:
    • The GameObject of the Interactable Object to detect interactions on.
    • Any other scene GameObject and then link that GameObject to the Interactable Objects Grab Attach Mechanic Script parameter to denote use of the grab mechanic.

Class Methods

StopGrab/1

public override void StopGrab(bool applyGrabbingObjectVelocity)

  • Parameters
    • bool applyGrabbingObjectVelocity - If true will apply the current velocity of the grabbing object to the grabbed Interactable Object on release.
  • Returns
    • none

The StopGrab method ends the grab of the current Interactable Object and cleans up the state.

ProcessFixedUpdate/0

public override void ProcessFixedUpdate()

  • Parameters
    • none
  • Returns
    • none

The ProcessFixedUpdate method is run in every FixedUpdate method on the Interactable Object. It applies a force to the grabbed Interactable Object to move it in the direction of the grabbing object.

Example

VRTK/Examples/021_Controller_GrabbingObjectsWithJoints demonstrates this grab attach mechanic on the Wheel and Door objects in the scene.