{"_id":"5b1f93ec3073470003ffa733","project":"571fa55ca0acd42000af9545","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"},"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"},"user":"571fa519db52d01700f5cf3d","githubsync":"","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-06-12T09:35:40.814Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":11,"body":"> extends [VRTK_BaseGrabAttach](doc:vrtk_basegrabattach)\n\n## Overview\n\nMoves the Transform of the Interactable Object towards the interacting object within specified limits.\n\n  > To allow unrestricted movement, set the axis limit minimum to `-infinity` and the axis limit maximum to `infinity`.\n\n**Script Usage:**\n * Place the `VRTK_MoveTransformGrabAttach` script on either:\n   * The GameObject of the Interactable Object to detect interactions on.\n   * 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.\n\n## Inspector Parameters\n\n * **Detach Distance:** The maximum distance the grabbing object is away from the Interactable Object before it is automatically released.\n * **Tracking Speed:** The speed in which to track the grabbed Interactable Object to the interacting object.\n * **Force Kinematic On Grab:** If this is checked then it will force the rigidbody on the Interactable Object to be `Kinematic` when the grab occurs.\n * **Release Deceleration Damper:** The damper in which to slow the Interactable Object down when released to simulate continued momentum. The higher the number, the faster the Interactable Object will come to a complete stop on release.\n * **Reset To Orign On Release Speed:** The speed in which the Interactable Object returns to it's origin position when released. If the `Reset To Orign On Release Speed` is `0f` then the position will not be reset.\n * **X Axis Limits:** The minimum and maximum limits the Interactable Object can be moved along the x axis.\n * **Y Axis Limits:** The minimum and maximum limits the Interactable Object can be moved along the y axis.\n * **Z Axis Limits:** The minimum and maximum limits the Interactable Object can be moved along the z axis.\n * **Min Max Threshold:** The threshold the position value needs to be within to register a min or max position value.\n * **Min Max Normalized Threshold:** The threshold the normalized position value needs to be within to register a min or max normalized position value.\n\n## Class Variables\n\n * `public Vector3 localOrigin` - The default local position of the Interactable Object.\n\n## Class Events\n\n * `TransformPositionChanged` - Emitted when the Transform position has changed.\n * `XAxisMinLimitReached` - Emitted when the Transform position has reached the X Axis Min Limit.\n * `XAxisMinLimitExited` - Emitted when the Transform position has exited the X Axis Min Limit.\n * `XAxisMaxLimitReached` - Emitted when the Transform position has reached the X Axis Max Limit.\n * `XAxisMaxLimitExited` - Emitted when the Transform position has exited the X Axis Max Limit.\n * `YAxisMinLimitReached` - Emitted when the Transform position has reached the Y Axis Min Limit.\n * `YAxisMinLimitExited` - Emitted when the Transform position has exited the Y Axis Min Limit.\n * `YAxisMaxLimitReached` - Emitted when the Transform position has reached the Y Axis Max Limit.\n * `YAxisMaxLimitExited` - Emitted when the Transform position has exited the Y Axis Max Limit.\n * `ZAxisMinLimitReached` - Emitted when the Transform position has reached the Z Axis Min Limit.\n * `ZAxisMinLimitExited` - Emitted when the Transform position has exited the Z Axis Min Limit.\n * `ZAxisMaxLimitReached` - Emitted when the Transform position has reached the Z Axis Max Limit.\n * `ZAxisMaxLimitExited` - Emitted when the Transform position has exited the Z Axis Max Limit.\n\n## Unity Events\n\nAdding the `VRTK_MoveTransformGrabAttach_UnityEvents` component to `VRTK_MoveTransformGrabAttach` object allows access to `UnityEvents` that will react identically to the Class Events.\n\n * All C# delegate events are mapped to a Unity Event with the `On` prefix. e.g. `MyEvent` -> `OnMyEvent`.\n\n## Event Payload\n\n * `GameObject interactingObject` - The GameObject that is performing the interaction (e.g. a controller).\n * `Vector3 position` - The current position in relation to the axis limits from the origin position.\n * `Vector3 normalizedPosition` - The normalized position (between `0f` and `1f`) of the Interactable Object in relation to the axis limits.\n * `Vector3 currentDirection` - The direction vector that the Interactable Object is currently moving across the axes in.\n * `Vector3 originDirection` - The direction vector that the Interactable Object is currently moving across the axes in in relation to the origin position.\n\n## Class Methods\n\n### StartGrab/3\n\n  > `public override 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 override 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 override 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 override 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### GetPosition/0\n\n  > `public virtual Vector3 GetPosition()`\n\n * Parameters\n   * _none_\n * Returns\n   * `Vector3` - A Vector3 containing the current Transform position in relation to the axis limits.\n\nThe GetPosition method returns a Vector3 of the Transform position in relation to the axis limits.\n\n### GetNormalizedPosition/0\n\n  > `public virtual Vector3 GetNormalizedPosition()`\n\n * Parameters\n   * _none_\n * Returns\n   * `Vector3` - A normalized Vector3 of the Transform position in relation to the axis limits.\n\nThe GetNormalizedPosition method returns a Vector3 of the Transform position normalized between `0f` and `1f` in relation to the axis limits.;\n\n### GetCurrentDirection/0\n\n  > `public virtual Vector3 GetCurrentDirection()`\n\n * Parameters\n   * _none_\n * Returns\n   * `Vector3` - A Vector3 of the direction the Transform is moving across the relevant axis in.\n\nThe GetCurrentDirection method returns a Vector3 of the current positive/negative axis direction that the Transform is moving in.\n\n### GetDirectionFromOrigin/0\n\n  > `public virtual Vector3 GetDirectionFromOrigin()`\n\n * Parameters\n   * _none_\n * Returns\n   * `Vector3` - A Vector3 of the direction the Transform is moving across the relevant axis in relation to the original position.\n\nThe GetDirectionFromOrigin method returns a Vector3 of the direction across the axis from the original position.\n\n### SetCurrentPosition/2\n\n  > `public virtual void SetCurrentPosition(Vector3 newPosition, float speed)`\n\n * Parameters\n   * `Vector3 newPosition` - The position to move the Interactable Object to.\n   * `float speed` - The speed in which to move the Interactable Object.\n * Returns\n   * _none_\n\nThe SetCurrentPosition method sets the position of the Interactable Object to the given new position at the appropriate speed.\n\n### ResetPosition/0\n\n  > `public virtual void ResetPosition()`\n\n * Parameters\n   * _none_\n * Returns\n   * _none_\n\nThe ResetPosition method will move the Interactable Object back to the origin position.\n\n### GetWorldLimits/0\n\n  > `public virtual Limits2D[] GetWorldLimits()`\n\n * Parameters\n   * _none_\n * Returns\n   * `Limits2D[]` - An array of axis limits in world space.\n\nThe GetWorldLimits method returns an array of minimum and maximum axis limits for the Interactable Object in world space.","excerpt":"","slug":"vrtk_movetransformgrabattach","type":"basic","title":"VRTK_MoveTransformGrabAttach"}

VRTK_MoveTransformGrabAttach


> extends [VRTK_BaseGrabAttach](doc:vrtk_basegrabattach) ## Overview Moves the Transform of the Interactable Object towards the interacting object within specified limits. > To allow unrestricted movement, set the axis limit minimum to `-infinity` and the axis limit maximum to `infinity`. **Script Usage:** * Place the `VRTK_MoveTransformGrabAttach` 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. ## Inspector Parameters * **Detach Distance:** The maximum distance the grabbing object is away from the Interactable Object before it is automatically released. * **Tracking Speed:** The speed in which to track the grabbed Interactable Object to the interacting object. * **Force Kinematic On Grab:** If this is checked then it will force the rigidbody on the Interactable Object to be `Kinematic` when the grab occurs. * **Release Deceleration Damper:** The damper in which to slow the Interactable Object down when released to simulate continued momentum. The higher the number, the faster the Interactable Object will come to a complete stop on release. * **Reset To Orign On Release Speed:** The speed in which the Interactable Object returns to it's origin position when released. If the `Reset To Orign On Release Speed` is `0f` then the position will not be reset. * **X Axis Limits:** The minimum and maximum limits the Interactable Object can be moved along the x axis. * **Y Axis Limits:** The minimum and maximum limits the Interactable Object can be moved along the y axis. * **Z Axis Limits:** The minimum and maximum limits the Interactable Object can be moved along the z axis. * **Min Max Threshold:** The threshold the position value needs to be within to register a min or max position value. * **Min Max Normalized Threshold:** The threshold the normalized position value needs to be within to register a min or max normalized position value. ## Class Variables * `public Vector3 localOrigin` - The default local position of the Interactable Object. ## Class Events * `TransformPositionChanged` - Emitted when the Transform position has changed. * `XAxisMinLimitReached` - Emitted when the Transform position has reached the X Axis Min Limit. * `XAxisMinLimitExited` - Emitted when the Transform position has exited the X Axis Min Limit. * `XAxisMaxLimitReached` - Emitted when the Transform position has reached the X Axis Max Limit. * `XAxisMaxLimitExited` - Emitted when the Transform position has exited the X Axis Max Limit. * `YAxisMinLimitReached` - Emitted when the Transform position has reached the Y Axis Min Limit. * `YAxisMinLimitExited` - Emitted when the Transform position has exited the Y Axis Min Limit. * `YAxisMaxLimitReached` - Emitted when the Transform position has reached the Y Axis Max Limit. * `YAxisMaxLimitExited` - Emitted when the Transform position has exited the Y Axis Max Limit. * `ZAxisMinLimitReached` - Emitted when the Transform position has reached the Z Axis Min Limit. * `ZAxisMinLimitExited` - Emitted when the Transform position has exited the Z Axis Min Limit. * `ZAxisMaxLimitReached` - Emitted when the Transform position has reached the Z Axis Max Limit. * `ZAxisMaxLimitExited` - Emitted when the Transform position has exited the Z Axis Max Limit. ## Unity Events Adding the `VRTK_MoveTransformGrabAttach_UnityEvents` component to `VRTK_MoveTransformGrabAttach` object allows access to `UnityEvents` that will react identically to the Class Events. * All C# delegate events are mapped to a Unity Event with the `On` prefix. e.g. `MyEvent` -> `OnMyEvent`. ## Event Payload * `GameObject interactingObject` - The GameObject that is performing the interaction (e.g. a controller). * `Vector3 position` - The current position in relation to the axis limits from the origin position. * `Vector3 normalizedPosition` - The normalized position (between `0f` and `1f`) of the Interactable Object in relation to the axis limits. * `Vector3 currentDirection` - The direction vector that the Interactable Object is currently moving across the axes in. * `Vector3 originDirection` - The direction vector that the Interactable Object is currently moving across the axes in in relation to the origin position. ## Class Methods ### StartGrab/3 > `public override 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 override 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 override 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 override void ProcessUpdate()` * Parameters * _none_ * Returns * _none_ The ProcessUpdate method is run in every Update method on the Interactable Object. ### GetPosition/0 > `public virtual Vector3 GetPosition()` * Parameters * _none_ * Returns * `Vector3` - A Vector3 containing the current Transform position in relation to the axis limits. The GetPosition method returns a Vector3 of the Transform position in relation to the axis limits. ### GetNormalizedPosition/0 > `public virtual Vector3 GetNormalizedPosition()` * Parameters * _none_ * Returns * `Vector3` - A normalized Vector3 of the Transform position in relation to the axis limits. The GetNormalizedPosition method returns a Vector3 of the Transform position normalized between `0f` and `1f` in relation to the axis limits.; ### GetCurrentDirection/0 > `public virtual Vector3 GetCurrentDirection()` * Parameters * _none_ * Returns * `Vector3` - A Vector3 of the direction the Transform is moving across the relevant axis in. The GetCurrentDirection method returns a Vector3 of the current positive/negative axis direction that the Transform is moving in. ### GetDirectionFromOrigin/0 > `public virtual Vector3 GetDirectionFromOrigin()` * Parameters * _none_ * Returns * `Vector3` - A Vector3 of the direction the Transform is moving across the relevant axis in relation to the original position. The GetDirectionFromOrigin method returns a Vector3 of the direction across the axis from the original position. ### SetCurrentPosition/2 > `public virtual void SetCurrentPosition(Vector3 newPosition, float speed)` * Parameters * `Vector3 newPosition` - The position to move the Interactable Object to. * `float speed` - The speed in which to move the Interactable Object. * Returns * _none_ The SetCurrentPosition method sets the position of the Interactable Object to the given new position at the appropriate speed. ### ResetPosition/0 > `public virtual void ResetPosition()` * Parameters * _none_ * Returns * _none_ The ResetPosition method will move the Interactable Object back to the origin position. ### GetWorldLimits/0 > `public virtual Limits2D[] GetWorldLimits()` * Parameters * _none_ * Returns * `Limits2D[]` - An array of axis limits in world space. The GetWorldLimits method returns an array of minimum and maximum axis limits for the Interactable Object in world space.