{"_id":"5b1f8f533073470003ffa6d0","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":"5b1f8576c2505d0003125428","version":"5b1f8576c2505d00031254db","project":"571fa55ca0acd42000af9545","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-01-01T16:41:26.797Z","from_sync":false,"order":4,"slug":"locomotion","title":"Locomotion"},"user":"571fa519db52d01700f5cf3d","githubsync":"","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-06-12T09:16:03.606Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":11,"body":"## Overview\n\nProvides the ability for the SDK Camera Rig to be thrown around with a jumping motion by slingshotting based on the pull back of each valid controller.\n\n**Required Components:**\n * `VRTK_PlayerClimb` - A Player Climb script for dealing with the physical throwing of the play area as if throwing off an invisible climbed object.\n * `VRTK_BodyPhysics` - A Body Physics script to deal with the effects of physics and gravity on the play area.\n\n**Optional Components:**\n * `VRTK_BasicTeleport` - A Teleporter script to use when snapping the play area to the nearest floor when releasing from grab.\n * `VRTK_HeadsetCollision` - A Headset Collision script to determine when the headset is colliding with geometry to know when to reset to a valid location.\n * `VRTK_PositionRewind` - A Position Rewind script to utilise when resetting to a valid location upon ungrabbing whilst colliding with geometry.\n\n**Script Usage:**\n * Place the `VRTK_SlingshotJump` script on the same GameObject as the `VRTK_PlayerClimb` script.\n\n## Inspector Parameters\n\n * **Release Window Time:** How close together the button releases have to be to initiate a jump.\n * **Velocity Multiplier:** Multiplier that increases the jump strength.\n * **Velocity Max:** The maximum velocity a jump can be.\n\n## Class Events\n\n * `SlingshotJumped` - Emitted when a slingshot jump occurs\n\n## Unity Events\n\nAdding the `VRTK_SlingshotJump_UnityEvents` component to `VRTK_SlingshotJump` 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## Class Methods\n\n### GetActivationButton/0\n\n  > `public virtual VRTK_ControllerEvents.ButtonAlias GetActivationButton()`\n\n * Parameters\n   * _none_\n * Returns\n   * `VRTK_ControllerEvents.ButtonAlias` - Returns the button used for slingshot activation.\n\nThe SetActivationButton method gets the button used to activate a slingshot jump.\n\n### SetActivationButton/1\n\n  > `public virtual void SetActivationButton(VRTK_ControllerEvents.ButtonAlias button)`\n\n * Parameters\n   * `VRTK_ControllerEvents.ButtonAlias button` - The controller button to use to activate the jump.\n * Returns\n   * _none_\n\nThe SetActivationButton method sets the button used to activate a slingshot jump.\n\n### GetCancelButton/0\n\n  > `public virtual VRTK_ControllerEvents.ButtonAlias GetCancelButton()`\n\n * Parameters\n   * _none_\n * Returns\n   * `VRTK_ControllerEvents.ButtonAlias` - Returns the button used to cancel a slingshot jump.\n\nThe GetCancelButton method gets the button used to cancel a slingshot jump.\n\n### SetCancelButton/1\n\n  > `public virtual void SetCancelButton(VRTK_ControllerEvents.ButtonAlias button)`\n\n * Parameters\n   * `VRTK_ControllerEvents.ButtonAlias button` - The controller button to use to cancel the jump.\n * Returns\n   * _none_\n\nThe SetCancelButton method sets the button used to cancel a slingshot jump.\n\n## Example\n\n`VRTK/Examples/037_CameraRig_ClimbingFalling` shows how to set up a scene with slingshot jumping. This script just needs to be added to the PlayArea object and the requested forces and buttons set.","excerpt":"","slug":"vrtk_slingshotjump","type":"basic","title":"VRTK_SlingshotJump"}

VRTK_SlingshotJump


## Overview Provides the ability for the SDK Camera Rig to be thrown around with a jumping motion by slingshotting based on the pull back of each valid controller. **Required Components:** * `VRTK_PlayerClimb` - A Player Climb script for dealing with the physical throwing of the play area as if throwing off an invisible climbed object. * `VRTK_BodyPhysics` - A Body Physics script to deal with the effects of physics and gravity on the play area. **Optional Components:** * `VRTK_BasicTeleport` - A Teleporter script to use when snapping the play area to the nearest floor when releasing from grab. * `VRTK_HeadsetCollision` - A Headset Collision script to determine when the headset is colliding with geometry to know when to reset to a valid location. * `VRTK_PositionRewind` - A Position Rewind script to utilise when resetting to a valid location upon ungrabbing whilst colliding with geometry. **Script Usage:** * Place the `VRTK_SlingshotJump` script on the same GameObject as the `VRTK_PlayerClimb` script. ## Inspector Parameters * **Release Window Time:** How close together the button releases have to be to initiate a jump. * **Velocity Multiplier:** Multiplier that increases the jump strength. * **Velocity Max:** The maximum velocity a jump can be. ## Class Events * `SlingshotJumped` - Emitted when a slingshot jump occurs ## Unity Events Adding the `VRTK_SlingshotJump_UnityEvents` component to `VRTK_SlingshotJump` 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`. ## Class Methods ### GetActivationButton/0 > `public virtual VRTK_ControllerEvents.ButtonAlias GetActivationButton()` * Parameters * _none_ * Returns * `VRTK_ControllerEvents.ButtonAlias` - Returns the button used for slingshot activation. The SetActivationButton method gets the button used to activate a slingshot jump. ### SetActivationButton/1 > `public virtual void SetActivationButton(VRTK_ControllerEvents.ButtonAlias button)` * Parameters * `VRTK_ControllerEvents.ButtonAlias button` - The controller button to use to activate the jump. * Returns * _none_ The SetActivationButton method sets the button used to activate a slingshot jump. ### GetCancelButton/0 > `public virtual VRTK_ControllerEvents.ButtonAlias GetCancelButton()` * Parameters * _none_ * Returns * `VRTK_ControllerEvents.ButtonAlias` - Returns the button used to cancel a slingshot jump. The GetCancelButton method gets the button used to cancel a slingshot jump. ### SetCancelButton/1 > `public virtual void SetCancelButton(VRTK_ControllerEvents.ButtonAlias button)` * Parameters * `VRTK_ControllerEvents.ButtonAlias button` - The controller button to use to cancel the jump. * Returns * _none_ The SetCancelButton method sets the button used to cancel a slingshot jump. ## Example `VRTK/Examples/037_CameraRig_ClimbingFalling` shows how to set up a scene with slingshot jumping. This script just needs to be added to the PlayArea object and the requested forces and buttons set.