{"_id":"5b1f8576c2505d0003125451","category":{"_id":"5b1f8576c2505d0003125430","version":"5b1f8576c2505d00031254db","project":"571fa55ca0acd42000af9545","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-01-01T17:04:07.774Z","from_sync":false,"order":13,"slug":"3d-controls","title":"Controllables"},"user":"571fa519db52d01700f5cf3d","parentDoc":null,"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"},"githubsync":"","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-01-01T17:06:28.702Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"> extends [VRTK_BasePhysicsControllable](doc:vrtk_basephysicscontrollable)\n\n## Overview\n\nA physics based slider.\n\n**Required Components:**\n * `Collider` - A Unity Collider to determine when an interaction has occured. Can be a compound collider set in child GameObjects. Will be automatically added at runtime.\n * `Rigidbody` - A Unity Rigidbody to allow the GameObject to be affected by the Unity Physics System. Will be automatically added at runtime.\n\n**Optional Components:**\n * `VRTK_ControllerRigidbodyActivator` - A Controller Rigidbody Activator to automatically enable the controller rigidbody when near the slider.\n\n**Script Usage:**\n * Create a slider container GameObject and set the GameObject that is to become the slider as a child of the container.\n * Place the `VRTK_PhysicsSlider` script onto the GameObject that is to become the slider.\n\n  > The slider GameObject must not be at the root level and needs to have it's Transform position set to `0,0,0`. This is the reason for the container GameObject requirement. Any positioning of the slider must be set on the parent GameObject.\n\n## Inspector Parameters\n\n * **Maximum Length:** The maximum length that the slider can be moved from the origin position across the `Operate Axis`. A negative value will allow it to move the opposite way.\n * **Min Max Threshold:** The normalized position the slider can be within the minimum or maximum slider positions before the minimum or maximum positions are considered reached.\n * **Position Target:** The target position to move the slider towards given in a normalized value of `0f` (start point) to `1f` (end point).\n * **Resting Position:** The position the slider when it is at the default resting point given in a normalized value of `0f` (start point) to `1f` (end point).\n * **Force Resting Position Threshold:** The normalized threshold value the slider has to be within the `Resting Position` before the slider is forced back to the `Resting Position` if it is not grabbed.\n * **Step Value Range:** The minimum and the maximum step values for the slider to register along the `Operate Axis`.\n * **Step Size:** The increments the slider value will change in between the `Step Value Range`.\n * **Use Step As Value:** If this is checked then the value for the slider will be the step value and not the absolute position of the slider Transform.\n * **Snap To Step:** If this is checked then the slider will snap to the position of the nearest step along the value range.\n * **Snap Force:** The speed in which the slider will snap to the relevant point along the `Operate Axis`\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 * **Detach Distance:** The maximum distance the grabbing object is away from the slider before it is automatically released.\n * **Release Friction:** The amount of friction to the slider Rigidbody when it is released.\n * **Only Interact With:** A collection of GameObjects that will be used as the valid collisions to determine if the door can be interacted with.\n\n## Class Methods\n\n### GetValue/0\n\n  > `public override float GetValue()`\n\n * Parameters\n   * _none_\n * Returns\n   * `float` - The actual position of the button.\n\nThe GetValue method returns the current position value of the slider.\n\n### GetNormalizedValue/0\n\n  > `public override float GetNormalizedValue()`\n\n * Parameters\n   * _none_\n * Returns\n   * `float` - The normalized position of the button.\n\nThe GetNormalizedValue method returns the current position value of the slider normalized between `0f` and `1f`.\n\n### SetValue/1\n\n  > `public override void SetValue(float value)`\n\n * Parameters\n   * `float value` - The new position value\n * Returns\n   * _none_\n\nThe SetValue method sets the current position value of the slider\n\n### GetStepValue/1\n\n  > `public virtual float GetStepValue(float currentValue)`\n\n * Parameters\n   * `float currentValue` - The current position value of the slider to get the Step Value for.\n * Returns\n   * `float` - The current Step Value based on the slider position.\n\nThe GetStepValue method returns the current position of the slider based on the step value range.\n\n### SetPositionTargetWithStepValue/1\n\n  > `public virtual void SetPositionTargetWithStepValue(float givenStepValue)`\n\n * Parameters\n   * `float givenStepValue` - The step value within the `Step Value Range` to set the `Position Target` parameter to.\n * Returns\n   * _none_\n\nThe SetTargetPositionWithStepValue sets the `Position Target` parameter but uses a value within the `Step Value Range`.\n\n### SetRestingPositionWithStepValue/1\n\n  > `public virtual void SetRestingPositionWithStepValue(float givenStepValue)`\n\n * Parameters\n   * `float givenStepValue` - The step value within the `Step Value Range` to set the `Resting Position` parameter to.\n * Returns\n   * _none_\n\nThe SetRestingPositionWithStepValue sets the `Resting Position` parameter but uses a value within the `Step Value Range`.\n\n### GetPositionFromStepValue/1\n\n  > `public virtual float GetPositionFromStepValue(float givenStepValue)`\n\n * Parameters\n   * `float givenStepValue` - The step value to check the position for.\n * Returns\n   * `float` - The position the slider would be at based on the given step value.\n\nThe GetPositionFromStepValue returns the position the slider would be at based on the given step value.\n\n### IsResting/0\n\n  > `public override bool IsResting()`\n\n * Parameters\n   * _none_\n * Returns\n   * `bool` - Returns `true` if the slider is at the resting position or within the resting position threshold.\n\nThe IsResting method returns whether the slider is currently in a resting state at the resting position or within the resting position threshold and not grabbed.\n\n### GetControlJoint/0\n\n  > `public virtual ConfigurableJoint GetControlJoint()`\n\n * Parameters\n   * _none_\n * Returns\n   * `ConfigurableJoint` - The joint associated with the control.\n\nThe GetControlJoint method returns the joint associated with the control.\n\n### GetControlInteractableObject/0\n\n  > `public virtual VRTK_InteractableObject GetControlInteractableObject()`\n\n * Parameters\n   * _none_\n * Returns\n   * `VRTK_InteractableObject` - The Interactable Object associated with the control.\n\nThe GetControlInteractableObject method returns the Interactable Object associated with the control.","excerpt":"","slug":"vrtk_drawer","type":"basic","title":"VRTK_PhysicsSlider"}

VRTK_PhysicsSlider


> extends [VRTK_BasePhysicsControllable](doc:vrtk_basephysicscontrollable) ## Overview A physics based slider. **Required Components:** * `Collider` - A Unity Collider to determine when an interaction has occured. Can be a compound collider set in child GameObjects. Will be automatically added at runtime. * `Rigidbody` - A Unity Rigidbody to allow the GameObject to be affected by the Unity Physics System. Will be automatically added at runtime. **Optional Components:** * `VRTK_ControllerRigidbodyActivator` - A Controller Rigidbody Activator to automatically enable the controller rigidbody when near the slider. **Script Usage:** * Create a slider container GameObject and set the GameObject that is to become the slider as a child of the container. * Place the `VRTK_PhysicsSlider` script onto the GameObject that is to become the slider. > The slider GameObject must not be at the root level and needs to have it's Transform position set to `0,0,0`. This is the reason for the container GameObject requirement. Any positioning of the slider must be set on the parent GameObject. ## Inspector Parameters * **Maximum Length:** The maximum length that the slider can be moved from the origin position across the `Operate Axis`. A negative value will allow it to move the opposite way. * **Min Max Threshold:** The normalized position the slider can be within the minimum or maximum slider positions before the minimum or maximum positions are considered reached. * **Position Target:** The target position to move the slider towards given in a normalized value of `0f` (start point) to `1f` (end point). * **Resting Position:** The position the slider when it is at the default resting point given in a normalized value of `0f` (start point) to `1f` (end point). * **Force Resting Position Threshold:** The normalized threshold value the slider has to be within the `Resting Position` before the slider is forced back to the `Resting Position` if it is not grabbed. * **Step Value Range:** The minimum and the maximum step values for the slider to register along the `Operate Axis`. * **Step Size:** The increments the slider value will change in between the `Step Value Range`. * **Use Step As Value:** If this is checked then the value for the slider will be the step value and not the absolute position of the slider Transform. * **Snap To Step:** If this is checked then the slider will snap to the position of the nearest step along the value range. * **Snap Force:** The speed in which the slider will snap to the relevant point along the `Operate Axis` * **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. * **Detach Distance:** The maximum distance the grabbing object is away from the slider before it is automatically released. * **Release Friction:** The amount of friction to the slider Rigidbody when it is released. * **Only Interact With:** A collection of GameObjects that will be used as the valid collisions to determine if the door can be interacted with. ## Class Methods ### GetValue/0 > `public override float GetValue()` * Parameters * _none_ * Returns * `float` - The actual position of the button. The GetValue method returns the current position value of the slider. ### GetNormalizedValue/0 > `public override float GetNormalizedValue()` * Parameters * _none_ * Returns * `float` - The normalized position of the button. The GetNormalizedValue method returns the current position value of the slider normalized between `0f` and `1f`. ### SetValue/1 > `public override void SetValue(float value)` * Parameters * `float value` - The new position value * Returns * _none_ The SetValue method sets the current position value of the slider ### GetStepValue/1 > `public virtual float GetStepValue(float currentValue)` * Parameters * `float currentValue` - The current position value of the slider to get the Step Value for. * Returns * `float` - The current Step Value based on the slider position. The GetStepValue method returns the current position of the slider based on the step value range. ### SetPositionTargetWithStepValue/1 > `public virtual void SetPositionTargetWithStepValue(float givenStepValue)` * Parameters * `float givenStepValue` - The step value within the `Step Value Range` to set the `Position Target` parameter to. * Returns * _none_ The SetTargetPositionWithStepValue sets the `Position Target` parameter but uses a value within the `Step Value Range`. ### SetRestingPositionWithStepValue/1 > `public virtual void SetRestingPositionWithStepValue(float givenStepValue)` * Parameters * `float givenStepValue` - The step value within the `Step Value Range` to set the `Resting Position` parameter to. * Returns * _none_ The SetRestingPositionWithStepValue sets the `Resting Position` parameter but uses a value within the `Step Value Range`. ### GetPositionFromStepValue/1 > `public virtual float GetPositionFromStepValue(float givenStepValue)` * Parameters * `float givenStepValue` - The step value to check the position for. * Returns * `float` - The position the slider would be at based on the given step value. The GetPositionFromStepValue returns the position the slider would be at based on the given step value. ### IsResting/0 > `public override bool IsResting()` * Parameters * _none_ * Returns * `bool` - Returns `true` if the slider is at the resting position or within the resting position threshold. The IsResting method returns whether the slider is currently in a resting state at the resting position or within the resting position threshold and not grabbed. ### GetControlJoint/0 > `public virtual ConfigurableJoint GetControlJoint()` * Parameters * _none_ * Returns * `ConfigurableJoint` - The joint associated with the control. The GetControlJoint method returns the joint associated with the control. ### GetControlInteractableObject/0 > `public virtual VRTK_InteractableObject GetControlInteractableObject()` * Parameters * _none_ * Returns * `VRTK_InteractableObject` - The Interactable Object associated with the control. The GetControlInteractableObject method returns the Interactable Object associated with the control.