Sets the grabbed Interactable Object to be a child of the grabbing object.
The Interactable Object will have 1:1 tracking of the grabbing object, however it will also have reduced collision detection and will be able to pass through other colliders.
- Place the
VRTK_ChildOfControllerGrabAttachscript 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 Scriptparameter to denote use of the grab mechanic.
public override bool StartGrab(GameObject grabbingObject, GameObject givenGrabbedObject, Rigidbody givenControllerAttachPoint)
GameObject grabbingObject- The GameObject that is doing the grabbing.
GameObject givenGrabbedObject- The GameObject that is being grabbed.
Rigidbody givenControllerAttachPoint- The point on the grabbing object that the grabbed object should be attached to after grab occurs.
trueif the grab is successful,
falseif the grab is unsuccessful.
The StartGrab method sets up the grab attach mechanic as soon as an Interactable Object is grabbed. It is also responsible for creating the joint on the grabbed object.
public override void StopGrab(bool applyGrabbingObjectVelocity)
bool applyGrabbingObjectVelocity- If
truewill apply the current velocity of the grabbing object to the grabbed object on release.
The StopGrab method ends the grab of the current Interactable Object and cleans up the state.
VRTK/Examples/023_Controller_ChildOfControllerOnGrab uses this grab attach mechanic for the bow and the arrow.
Updated less than a minute ago