{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","results":{"codes":[]},"settings":"","params":[]},"next":{"description":"","pages":[]},"title":"VRTK_MoveTransformGrabAttach","type":"basic","slug":"vrtk_movetransformgrabattach","excerpt":"","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.","updates":[],"order":11,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5b1f93ec3073470003ffa733","project":"571fa55ca0acd42000af9545","version":{"version":"3.3.0","version_clean":"3.3.0","codename":"Mangalica","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"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"],"_id":"5b1f8576c2505d00031254db","project":"571fa55ca0acd42000af9545","__v":4,"forked_from":"594949e52be16d0026ec04cd","createdAt":"2017-06-20T16:14:29.816Z","releaseDate":"2017-06-20T16:14:29.816Z"},"category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Grab Attach Mechanics","slug":"grab-attach-mechanics","order":9,"from_sync":false,"reference":false,"_id":"5b1f8576c2505d000312542c","version":"5b1f8576c2505d00031254db","project":"571fa55ca0acd42000af9545","createdAt":"2017-01-01T16:50:06.279Z","__v":0},"user":"571fa519db52d01700f5cf3d","createdAt":"2018-06-12T09:35:40.814Z","githubsync":"","__v":0,"parentDoc":null}