UnityMol  1.0.25beta
VRTK.GrabAttachMechanics.VRTK_GrabByChild Class Reference

Sets the grabbed Interactable Object to be a child of the grabbing object. More...

Inheritance diagram for VRTK.GrabAttachMechanics.VRTK_GrabByChild:

Public Member Functions

override bool StartGrab (GameObject grabbingObject, GameObject givenGrabbedObject, Rigidbody givenControllerAttachPoint)
 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. More...
 
override void StopGrab (bool applyGrabbingObjectVelocity)
 The StopGrab method ends the grab of the current Interactable Object and cleans up the state. More...
 

Protected Member Functions

override void Initialise ()
 
virtual void SnapObjectToGrabToController (GameObject grabbingObject, GameObject obj)
 

Detailed Description

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.

Script Usage:

  • Place the VRTK_ChildOfControllerGrabAttach 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.

VRTK/Examples/023_Controller_ChildOfControllerOnGrab uses this grab attach mechanic for the bow and the arrow.

Member Function Documentation

◆ Initialise()

override void VRTK.GrabAttachMechanics.VRTK_GrabByChild.Initialise ( )
protected

◆ SnapObjectToGrabToController()

virtual void VRTK.GrabAttachMechanics.VRTK_GrabByChild.SnapObjectToGrabToController ( GameObject  grabbingObject,
GameObject  obj 
)
protectedvirtual

◆ StartGrab()

override bool VRTK.GrabAttachMechanics.VRTK_GrabByChild.StartGrab ( GameObject  grabbingObject,
GameObject  givenGrabbedObject,
Rigidbody  givenControllerAttachPoint 
)

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.

Parameters
grabbingObjectThe GameObject that is doing the grabbing.
givenGrabbedObjectThe GameObject that is being grabbed.
givenControllerAttachPointThe point on the grabbing object that the grabbed object should be attached to after grab occurs.
Returns
Returns true if the grab is successful, false if the grab is unsuccessful.

◆ StopGrab()

override void VRTK.GrabAttachMechanics.VRTK_GrabByChild.StopGrab ( bool  applyGrabbingObjectVelocity)

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

Parameters
applyGrabbingObjectVelocityIf true will apply the current velocity of the grabbing object to the grabbed object on release.

The documentation for this class was generated from the following file: