{"__v":0,"_id":"58796783cd4a9c37007c9765","category":{"version":"58796781cd4a9c37007c96ef","project":"571fa55ca0acd42000af9545","_id":"58796781cd4a9c37007c96f6","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-01-01T16:50:06.279Z","from_sync":false,"order":8,"slug":"grab-attach-mechanics","title":"Grab Attach Mechanics"},"parentDoc":null,"project":"571fa55ca0acd42000af9545","user":"571fa519db52d01700f5cf3d","version":{"__v":4,"_id":"58796781cd4a9c37007c96ef","project":"571fa55ca0acd42000af9545","createdAt":"2017-01-13T23:49:21.393Z","releaseDate":"2017-01-13T23:49:21.393Z","categories":["58796781cd4a9c37007c96f0","58796781cd4a9c37007c96f1","58796781cd4a9c37007c96f2","58796781cd4a9c37007c96f3","58796781cd4a9c37007c96f4","58796781cd4a9c37007c96f5","58796781cd4a9c37007c96f6","58796781cd4a9c37007c96f7","58796781cd4a9c37007c96f8","58796781cd4a9c37007c96f9","58796781cd4a9c37007c96fa","58796781cd4a9c37007c96fb","58796781cd4a9c37007c96fc","58796781cd4a9c37007c96fd","58796781cd4a9c37007c96fe","58796781cd4a9c37007c96ff","58796781cd4a9c37007c9700","58b157ca1756cf370022f90d","58b1596f5dae732f00adeca2","58b1605a5dae732f00adecb1"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Mukota","version_clean":"3.1.0","version":"3.1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-01-01T16:50:50.843Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"## Overview\n\nThe Base Grab Attach script is an abstract class that all grab attach script inherit.\n\nAs this is an abstract class, it cannot be applied directly to a game object and performs no logic.\n\n## Inspector Parameters\n\n * **Precision Grab:** If this is checked then when the controller grabs the object, it will grab it with precision and pick it up at the particular point on the object the controller is touching.\n * **Right Snap Handle:** A Transform provided as an empty game object which must be the child of the item being grabbed and serves as an orientation point to rotate and position the grabbed item in relation to the right handed controller. 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 object will be grabbed at its central point. Not required for `Precision Snap`.\n * **Left Snap Handle:** A Transform provided as an empty game object which must be the child of the item being grabbed and serves as an orientation point to rotate and position the grabbed item in relation to the left handed controller. 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 object will be grabbed at its central point. Not required for `Precision Snap`.\n * **Throw Velocity With Attach Distance:** If checked then when the object is thrown, the distance between the object's attach point and the controller's attach point will be used to calculate a faster throwing velocity.\n * **Throw Multiplier:** An amount to multiply the velocity of the given object when it is thrown. This can also be used in conjunction with the Interact Grab Throw Multiplier to have certain 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 object when it is first grabbed. This is useful if a game object may get stuck inside another object when it is being grabbed.\n\n## Class Methods\n\n### IsTracked/0\n\n  > `public 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 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 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` -\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 object.\n  * Returns\n   * _none_\n\nThe SetTrackPoint method sets the point on the grabbed 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 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 object that is doing the grabbing.\n   * `GameObject givenGrabbedObject` - The object 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` - Is 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 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 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 object that is currently being grabbed.\n   * `GameObject currentGrabbingObject` - The object 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.","excerpt":"","slug":"vrtk_basegrabattach","type":"basic","title":"VRTK_BaseGrabAttach"}

VRTK_BaseGrabAttach


## Overview The Base Grab Attach script is an abstract class that all grab attach script inherit. As this is an abstract class, it cannot be applied directly to a game object and performs no logic. ## Inspector Parameters * **Precision Grab:** If this is checked then when the controller grabs the object, it will grab it with precision and pick it up at the particular point on the object the controller is touching. * **Right Snap Handle:** A Transform provided as an empty game object which must be the child of the item being grabbed and serves as an orientation point to rotate and position the grabbed item in relation to the right handed controller. 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 object will be grabbed at its central point. Not required for `Precision Snap`. * **Left Snap Handle:** A Transform provided as an empty game object which must be the child of the item being grabbed and serves as an orientation point to rotate and position the grabbed item in relation to the left handed controller. 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 object will be grabbed at its central point. Not required for `Precision Snap`. * **Throw Velocity With Attach Distance:** If checked then when the object is thrown, the distance between the object's attach point and the controller's attach point will be used to calculate a faster throwing velocity. * **Throw Multiplier:** An amount to multiply the velocity of the given object when it is thrown. This can also be used in conjunction with the Interact Grab Throw Multiplier to have certain 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 object when it is first grabbed. This is useful if a game object may get stuck inside another object when it is being grabbed. ## Class Methods ### IsTracked/0 > `public 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 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 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` - * 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 object. * Returns * _none_ The SetTrackPoint method sets the point on the grabbed 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 object where the initial grab happened. ### StartGrab/3 > `public virtual bool StartGrab(GameObject grabbingObject, GameObject givenGrabbedObject, Rigidbody givenControllerAttachPoint)` * Parameters * `GameObject grabbingObject` - The object that is doing the grabbing. * `GameObject givenGrabbedObject` - The object 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` - Is 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 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 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 object that is currently being grabbed. * `GameObject currentGrabbingObject` - The object 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.