{"_id":"5b1f8576c2505d0003125493","category":{"_id":"5b1f8576c2505d000312542c","version":"5b1f8576c2505d00031254db","project":"571fa55ca0acd42000af9545","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-01-01T16:50:06.279Z","from_sync":false,"order":9,"slug":"grab-attach-mechanics","title":"Grab Attach Mechanics"},"parentDoc":null,"project":"571fa55ca0acd42000af9545","user":"571fa519db52d01700f5cf3d","version":{"_id":"5b1f8576c2505d00031254db","project":"571fa55ca0acd42000af9545","__v":4,"forked_from":"594949e52be16d0026ec04cd","createdAt":"2017-06-20T16:14:29.816Z","releaseDate":"2017-06-20T16:14:29.816Z","categories":["5b1f8576c2505d0003125424","5b1f8576c2505d0003125425","5b1f8576c2505d0003125426","5b1f8576c2505d0003125427","5b1f8576c2505d0003125428","5b1f8576c2505d0003125429","5b1f8576c2505d000312542a","5b1f8576c2505d000312542b","5b1f8576c2505d000312542c","5b1f8576c2505d000312542d","5b1f8576c2505d000312542e","5b1f8576c2505d000312542f","5b1f8576c2505d0003125430","5b1f8576c2505d0003125431","5b1f8576c2505d0003125432","5b1f8576c2505d0003125433","5b1f8576c2505d0003125434","5b1f8576c2505d0003125435","5b1f8576c2505d0003125436","5b1f8576c2505d0003125437","5b1f8576c2505d0003125438","5b1f8aab9c683000032979e7","5b1f8b2f3073470003ffa5da","5b1f8bd9fd653400031d94f4","5b1f900bd4c5f000036b57bd"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Mangalica","version_clean":"3.3.0","version":"3.3.0"},"githubsync":"","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-01-01T16:50:50.843Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"## Overview\n\nProvides a base that all grab attach mechanics can inherit from.\n\n**Script Usage:**\n  > This is an abstract class that is to be inherited to a concrete class that provides grab attach functionality, therefore this script should not be directly used.\n\n## Inspector Parameters\n\n * **Precision Grab:** If this is checked then when the Interact Grab grabs the Interactable Object, it will grab it with precision and pick it up at the particular point on the Interactable Object that the Interact Touch is touching.\n * **Right Snap Handle:** A Transform provided as an empty GameObject which must be the child of the Interactable Object being grabbed and serves as an orientation point to rotate and position the grabbed Interactable Object in relation to the right handed Interact Grab. If no Right Snap Handle is provided but a Left Snap Handle is provided, then the Left Snap Handle will be used in place. If no Snap Handle is provided then the Interactable Object will be grabbed at its central point. Not required for `Precision Grab`.\n * **Left Snap Handle:** A Transform provided as an empty GameObject which must be the child of the Interactable Object being grabbed and serves as an orientation point to rotate and position the grabbed Interactable Object in relation to the left handed Interact Grab. If no Left Snap Handle is provided but a Right Snap Handle is provided, then the Right Snap Handle will be used in place. If no Snap Handle is provided then the Interactable Object will be grabbed at its central point. Not required for `Precision Grab`.\n * **Throw Velocity With Attach Distance:** If checked then when the Interactable Object is thrown, the distance between the Interactable Object's attach point and the Interact Grab's attach point will be used to calculate a faster throwing velocity.\n * **Throw Multiplier:** An amount to multiply the velocity of the given Interactable Object when it is thrown. This can also be used in conjunction with the Interact Grab Throw Multiplier to have certain Interactable Objects be thrown even further than normal (or thrown a shorter distance if a number below 1 is entered).\n * **On Grab Collision Delay:** The amount of time to delay collisions affecting the Interactable Object when it is first grabbed. This is useful if the Interactable Object could get stuck inside another GameObject when it is being grabbed.\n\n## Class Methods\n\n### IsTracked/0\n\n  > `public virtual bool IsTracked()`\n\n * Parameters\n   * _none_\n * Returns\n   * `bool` - Is true if the mechanic is of type tracked.\n\nThe IsTracked method determines if the grab attach mechanic is a track object type.\n\n### IsClimbable/0\n\n  > `public virtual bool IsClimbable()`\n\n * Parameters\n   * _none_\n * Returns\n   * `bool` - Is true if the mechanic is of type climbable.\n\nThe IsClimbable method determines if the grab attach mechanic is a climbable object type.\n\n### IsKinematic/0\n\n  > `public virtual bool IsKinematic()`\n\n * Parameters\n   * _none_\n * Returns\n   * `bool` - Is true if the mechanic is of type kinematic.\n\nThe IsKinematic method determines if the grab attach mechanic is a kinematic object type.\n\n### ValidGrab/1\n\n  > `public virtual bool ValidGrab(Rigidbody checkAttachPoint)`\n\n * Parameters\n   * `Rigidbody checkAttachPoint` - The rigidbody attach point to check.\n * Returns\n   * `bool` - Always returns `true` for the base check.\n\nThe ValidGrab method determines if the grab attempt is valid.\n\n### SetTrackPoint/1\n\n  > `public virtual void SetTrackPoint(Transform givenTrackPoint)`\n\n * Parameters\n   * `Transform givenTrackPoint` - The track point to set on the grabbed Interactable Object.\n * Returns\n   * _none_\n\nThe SetTrackPoint method sets the point on the grabbed Interactable Object where the grab is happening.\n\n### SetInitialAttachPoint/1\n\n  > `public virtual void SetInitialAttachPoint(Transform givenInitialAttachPoint)`\n\n * Parameters\n   * `Transform givenInitialAttachPoint` - The point where the initial grab took place.\n * Returns\n   * _none_\n\nThe SetInitialAttachPoint method sets the point on the grabbed Interactable Object where the initial grab happened.\n\n### StartGrab/3\n\n  > `public virtual bool StartGrab(GameObject grabbingObject, GameObject givenGrabbedObject, Rigidbody givenControllerAttachPoint)`\n\n * Parameters\n   * `GameObject grabbingObject` - The GameObject that is doing the grabbing.\n   * `GameObject givenGrabbedObject` - The GameObject that is being grabbed.\n   * `Rigidbody givenControllerAttachPoint` - The point on the grabbing object that the grabbed object should be attached to after grab occurs.\n * Returns\n   * `bool` - Returns `true` if the grab is successful, `false` if the grab is unsuccessful.\n\nThe StartGrab method sets up the grab attach mechanic as soon as an Interactable Object is grabbed.\n\n### StopGrab/1\n\n  > `public virtual void StopGrab(bool applyGrabbingObjectVelocity)`\n\n * Parameters\n   * `bool applyGrabbingObjectVelocity` - If `true` will apply the current velocity of the grabbing object to the grabbed object on release.\n * Returns\n   * _none_\n\nThe StopGrab method ends the grab of the current Interactable Object and cleans up the state.\n\n### CreateTrackPoint/4\n\n  > `public virtual Transform CreateTrackPoint(Transform controllerPoint, GameObject currentGrabbedObject, GameObject currentGrabbingObject, ref bool customTrackPoint)`\n\n * Parameters\n   * `Transform controllerPoint` - The point on the controller where the grab was initiated.\n   * `GameObject currentGrabbedObject` - The GameObject that is currently being grabbed.\n   * `GameObject currentGrabbingObject` - The GameObject that is currently doing the grabbing.\n   * `ref bool customTrackPoint` - A reference to whether the created track point is an auto generated custom object.\n * Returns\n   * `Transform` - The Transform of the created track point.\n\nThe CreateTrackPoint method sets up the point of grab to track on the grabbed object.\n\n### ProcessUpdate/0\n\n  > `public virtual void ProcessUpdate()`\n\n * Parameters\n   * _none_\n * Returns\n   * _none_\n\nThe ProcessUpdate method is run in every Update method on the Interactable Object.\n\n### ProcessFixedUpdate/0\n\n  > `public virtual void ProcessFixedUpdate()`\n\n * Parameters\n   * _none_\n * Returns\n   * _none_\n\nThe ProcessFixedUpdate method is run in every FixedUpdate method on the Interactable Object.\n\n### ResetState/0\n\n  > `public virtual void ResetState()`\n\n * Parameters\n   * _none_\n * Returns\n   * _none_\n\nThe ResetState method re-initializes the grab attach.","excerpt":"","slug":"vrtk_basegrabattach","type":"basic","title":"VRTK_BaseGrabAttach"}

VRTK_BaseGrabAttach


## Overview Provides a base that all grab attach mechanics can inherit from. **Script Usage:** > This is an abstract class that is to be inherited to a concrete class that provides grab attach functionality, therefore this script should not be directly used. ## Inspector Parameters * **Precision Grab:** If this is checked then when the Interact Grab grabs the Interactable Object, it will grab it with precision and pick it up at the particular point on the Interactable Object that the Interact Touch is touching. * **Right Snap Handle:** A Transform provided as an empty GameObject which must be the child of the Interactable Object being grabbed and serves as an orientation point to rotate and position the grabbed Interactable Object in relation to the right handed Interact Grab. If no Right Snap Handle is provided but a Left Snap Handle is provided, then the Left Snap Handle will be used in place. If no Snap Handle is provided then the Interactable Object will be grabbed at its central point. Not required for `Precision Grab`. * **Left Snap Handle:** A Transform provided as an empty GameObject which must be the child of the Interactable Object being grabbed and serves as an orientation point to rotate and position the grabbed Interactable Object in relation to the left handed Interact Grab. If no Left Snap Handle is provided but a Right Snap Handle is provided, then the Right Snap Handle will be used in place. If no Snap Handle is provided then the Interactable Object will be grabbed at its central point. Not required for `Precision Grab`. * **Throw Velocity With Attach Distance:** If checked then when the Interactable Object is thrown, the distance between the Interactable Object's attach point and the Interact Grab's attach point will be used to calculate a faster throwing velocity. * **Throw Multiplier:** An amount to multiply the velocity of the given Interactable Object when it is thrown. This can also be used in conjunction with the Interact Grab Throw Multiplier to have certain Interactable Objects be thrown even further than normal (or thrown a shorter distance if a number below 1 is entered). * **On Grab Collision Delay:** The amount of time to delay collisions affecting the Interactable Object when it is first grabbed. This is useful if the Interactable Object could get stuck inside another GameObject when it is being grabbed. ## Class Methods ### IsTracked/0 > `public virtual bool IsTracked()` * Parameters * _none_ * Returns * `bool` - Is true if the mechanic is of type tracked. The IsTracked method determines if the grab attach mechanic is a track object type. ### IsClimbable/0 > `public virtual bool IsClimbable()` * Parameters * _none_ * Returns * `bool` - Is true if the mechanic is of type climbable. The IsClimbable method determines if the grab attach mechanic is a climbable object type. ### IsKinematic/0 > `public virtual bool IsKinematic()` * Parameters * _none_ * Returns * `bool` - Is true if the mechanic is of type kinematic. The IsKinematic method determines if the grab attach mechanic is a kinematic object type. ### ValidGrab/1 > `public virtual bool ValidGrab(Rigidbody checkAttachPoint)` * Parameters * `Rigidbody checkAttachPoint` - The rigidbody attach point to check. * Returns * `bool` - Always returns `true` for the base check. The ValidGrab method determines if the grab attempt is valid. ### SetTrackPoint/1 > `public virtual void SetTrackPoint(Transform givenTrackPoint)` * Parameters * `Transform givenTrackPoint` - The track point to set on the grabbed Interactable Object. * Returns * _none_ The SetTrackPoint method sets the point on the grabbed Interactable Object where the grab is happening. ### SetInitialAttachPoint/1 > `public virtual void SetInitialAttachPoint(Transform givenInitialAttachPoint)` * Parameters * `Transform givenInitialAttachPoint` - The point where the initial grab took place. * Returns * _none_ The SetInitialAttachPoint method sets the point on the grabbed Interactable Object where the initial grab happened. ### StartGrab/3 > `public virtual bool StartGrab(GameObject grabbingObject, GameObject givenGrabbedObject, Rigidbody givenControllerAttachPoint)` * Parameters * `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. * Returns * `bool` - Returns `true` if the grab is successful, `false` if the grab is unsuccessful. The StartGrab method sets up the grab attach mechanic as soon as an Interactable Object is grabbed. ### StopGrab/1 > `public virtual void StopGrab(bool applyGrabbingObjectVelocity)` * Parameters * `bool applyGrabbingObjectVelocity` - If `true` will apply the current velocity of the grabbing object to the grabbed object on release. * Returns * _none_ The StopGrab method ends the grab of the current Interactable Object and cleans up the state. ### CreateTrackPoint/4 > `public virtual Transform CreateTrackPoint(Transform controllerPoint, GameObject currentGrabbedObject, GameObject currentGrabbingObject, ref bool customTrackPoint)` * Parameters * `Transform controllerPoint` - The point on the controller where the grab was initiated. * `GameObject currentGrabbedObject` - The GameObject that is currently being grabbed. * `GameObject currentGrabbingObject` - The GameObject that is currently doing the grabbing. * `ref bool customTrackPoint` - A reference to whether the created track point is an auto generated custom object. * Returns * `Transform` - The Transform of the created track point. The CreateTrackPoint method sets up the point of grab to track on the grabbed object. ### ProcessUpdate/0 > `public virtual void ProcessUpdate()` * Parameters * _none_ * Returns * _none_ The ProcessUpdate method is run in every Update method on the Interactable Object. ### ProcessFixedUpdate/0 > `public virtual void ProcessFixedUpdate()` * Parameters * _none_ * Returns * _none_ The ProcessFixedUpdate method is run in every FixedUpdate method on the Interactable Object. ### ResetState/0 > `public virtual void ResetState()` * Parameters * _none_ * Returns * _none_ The ResetState method re-initializes the grab attach.