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 theVRTK_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.
Updated less than a minute ago