Skip to content

Commit 77afbe4

Browse files
committed
feat(Input): ability to switch script input button based on sdk type
A new SDK Input Override script has been added that allows the input button on the numerous scripts to be changed at runtime based on the SDK being used or the controller type connected. This script is in place of the proposed signal system which will be more robust and more versatile than the sdk input override solution. However, due to the way controller events still work, this is the only viable solution right now. Hopefully, this script can be deprecated in the future when/if the new signal system is implemented.
1 parent a744c1c commit 77afbe4

File tree

5 files changed

+525
-1
lines changed

5 files changed

+525
-1
lines changed

Assets/VRTK/Documentation/API.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,17 @@ The GetRotation method returns the current reported rotation of the direction in
667667

668668
The SetMaterialColor method sets the current material colour on the direction indicator.
669669

670+
#### GetControllerEvents/0
671+
672+
> `public virtual VRTK_ControllerEvents GetControllerEvents()`
673+
674+
* Parameters
675+
* _none_
676+
* Returns
677+
* `VRTK_ControllerEvents` - The associated Controller Events script.
678+
679+
The GetControllerEvents method returns the associated Controller Events script with the Pointer Direction Indicator script.
680+
670681
---
671682

672683
## Radial Menu (VRTK_RadialMenu)
@@ -8240,6 +8251,7 @@ A collection of scripts that provide useful functionality to aid the creation pr
82408251
* [SDK Object Alias](#sdk-object-alias-vrtk_sdkobjectalias)
82418252
* [SDK Transform Modify](#sdk-transform-modify-vrtk_sdktransformmodify)
82428253
* [SDK Object State](#sdk-object-state-vrtk_sdkobjectstate)
8254+
* [SDK Input Override](#sdk-input-override-vrtk_sdkinputoverride)
82438255
* [Velocity Estimator](#velocity-estimator-vrtk_velocityestimator)
82448256

82458257
---
@@ -9778,6 +9790,66 @@ The SetStateByControllerReference method sets the object state based on the cont
97789790

97799791
---
97809792

9793+
## SDK Input Override (VRTK_SDKInputOverride)
9794+
> extends VRTK_SDKControllerReady
9795+
9796+
### Overview
9797+
9798+
Provides the ability to switch button mappings based on the current SDK or controller type
9799+
9800+
**Script Usage:**
9801+
* Place the `VRTK_PlayerClimb` script on any active scene GameObject.
9802+
9803+
### Inspector Parameters
9804+
9805+
* **Loaded SDK Setup:** An optional SDK Setup to use to determine when to modify the transform.
9806+
* **Controller Type:** An optional SDK controller type to use to determine when to modify the transform.
9807+
* **Override Button:** The button to override to.
9808+
* **Override Axis:** The Vector2 axis to override to.
9809+
* **Interact Grab Script:** The Interact Grab script to override the controls on.
9810+
* **Interact Grab Overrides:** The list of overrides.
9811+
* **Interact Use Script:** The Interact Use script to override the controls on.
9812+
* **Interact Use Overrides:** The list of overrides.
9813+
* **Pointer Script:** The Pointer script to override the controls on.
9814+
* **Pointer Activation Overrides:** The list of overrides for the activation button.
9815+
* **Pointer Selection Overrides:** The list of overrides for the selection button.
9816+
* **Ui Pointer Script:** The UI Pointer script to override the controls on.
9817+
* **Ui Pointer Activation Overrides:** The list of overrides for the activation button.
9818+
* **Ui Pointer Selection Overrides:** The list of overrides for the selection button.
9819+
* **Pointer Direction Indicator Script:** The Pointer Direction Indicator script to override the controls on.
9820+
* **Direction Indicator Coordinate Overrides:** The list of overrides for the coordinate axis.
9821+
* **Touchpad Control Script:** The Touchpad Control script to override the controls on.
9822+
* **Touchpad Control Coordinate Overrides:** The list of overrides for the Touchpad Control coordinate axis.
9823+
* **Touchpad Control Activation Overrides:** The list of overrides for the activation button.
9824+
* **Touchpad Control Modifier Overrides:** The list of overrides for the modifier button.
9825+
* **Button Control Script:** The ButtonControl script to override the controls on.
9826+
* **Button Control Forward Overrides:** The list of overrides for the forward button.
9827+
* **Button Control Backward Overrides:** The list of overrides for the backward button.
9828+
* **Button Control Left Overrides:** The list of overrides for the left button.
9829+
* **Button Control Right Overrides:** The list of overrides for the right button.
9830+
* **Slingshot Jump Script:** The SlingshotJump script to override the controls on.
9831+
* **Slingshot Jump Activation Overrides:** The list of overrides for the activation button.
9832+
* **Slingshot Jump Cancel Overrides:** The list of overrides for the cancel button.
9833+
* **Move In Place Script:** The MoveInPlace script to override the controls on.
9834+
* **Move In Place Engage Overrides:** The list of overrides for the engage button.
9835+
* **Step Multiplier Script:** The Step Multiplier script to override the controls on.
9836+
* **Step Multiplier Activation Overrides:** The list of overrides for the activation button.
9837+
9838+
### Class Methods
9839+
9840+
#### ForceManage/0
9841+
9842+
> `public virtual void ForceManage()`
9843+
9844+
* Parameters
9845+
* _none_
9846+
* Returns
9847+
* _none_
9848+
9849+
The ForceManage method forces the inputs to be updated even without an SDK change event occuring.
9850+
9851+
---
9852+
97819853
## Velocity Estimator (VRTK_VelocityEstimator)
97829854

97839855
### Overview

Assets/VRTK/Prefabs/PointerDirectionIndicator/VRTK_PointerDirectionIndicator.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,15 @@ public virtual void SetMaterialColor(Color color, bool validity)
129129
}
130130
}
131131

132+
/// <summary>
133+
/// The GetControllerEvents method returns the associated Controller Events script with the Pointer Direction Indicator script.
134+
/// </summary>
135+
/// <returns>The associated Controller Events script.</returns>
136+
public virtual VRTK_ControllerEvents GetControllerEvents()
137+
{
138+
return controllerEvents;
139+
}
140+
132141
protected virtual void Awake()
133142
{
134143
validLocation = transform.Find("ValidLocation").gameObject;

0 commit comments

Comments
 (0)