A class in Root.Township, the global namespace.
One hand's input component on the platform player. Holds the hand index, raw button state, the D-pad helper and haptics. Client side; get it from the player's LeftInput or RightInput.
Constructors
| Member | What it is |
|---|
PlayerInput() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private ControllerActionsManager actionsManager | The actions manager for this hand. |
private HandIndex handIndex | Which hand this input is for. |
private DeviceInputController inputController | The platform controller feeding this hand; set by SetPlatformController. |
private Transform targetTransform | Backing field for TargetTransform. |
private VRTrackedDevice vrTrackedDevice | Tracked device for the target transform; disposed when the target changes. |
Properties
| Member | What it is |
|---|
ControllerActionsManager ActionsManager { get; } | The ControllerActionsManager set on the prefab for this hand. |
ControllerDPad DPad { get; private set; } | A ControllerDPad created in Awake and updated every frame for this hand. |
HandIndex HandIndex { get; } | Which hand this input is for (left or right), set on the prefab. |
bool HasPlatformController { get; private set; } | True once SetPlatformController has given this hand a device input controller. |
DeviceInputController InputController { get; } | The device input controller that feeds this hand, or null until one is set. |
PlayerInput OtherPlayerInput { get; } | The input for the opposite hand, taken from the owning player. |
IPlatformPlayer Player { get; private set; } | The platform player this hand belongs to, set by InitializeForPlayer. |
ControllerInput RawInput { get; } | The ControllerInput holding this hand's current button and axis values. The input controller writes into it each frame while the player is loaded. |
Transform TargetTransform { get; set; } | The transform the hand tracks. Setting a new one rebuilds the tracked device (empty in this build). |
1 private and internal property
Events
| Member | What it is |
|---|
event Action<PlayerInput> ReceivedController | Raised when SetPlatformController assigns a device input controller. |
Methods
| Member | What it is |
|---|
void InitializeForPlayer(IPlatformPlayer player) | Stores the platform player that owns this hand. Needed before OtherPlayerInput works. |
void SetPlatformController(DeviceInputController inputController) | Assigns the device input controller for this hand and raises ReceivedController. |
void TriggerHaptic(float strength, float duration, float frequency = 80) | Client: vibrates this controller, either at a fixed strength for a duration or following a curve. Scaled by the haptics strength setting; does nothing without a controller. |
void TriggerHaptic(AnimationCurve curve, float strength = 1, float frequency = 80) | Client: vibrates this controller, either at a fixed strength for a duration or following a curve. Scaled by the haptics strength setting; does nothing without a controller. |
9 private and internal methods
| Member | What it is |
|---|
private void Awake() | Creates the D-pad helper. |
private void CreateTrackedDevice() | Empty in this build. |
private IEnumerator Haptic(float strength, float duration, float frequency) (iterator) | Coroutine that plays a haptic pulse, either at a fixed strength for a duration or following a curve, scaled by the haptics strength setting. |
private IEnumerator Haptic(AnimationCurve curve, float strength, float frequency) (iterator) | Coroutine that plays a haptic pulse, either at a fixed strength for a duration or following a curve, scaled by the haptics strength setting. |
private void OnDisable() | Disables the D-pad, disposes the tracked device and stops the pre-render position update. |
private void OnEnable() | Enables the D-pad and hooks the pre-render position update. |
private void PositionPostProcessor(ref Vector3 input) | Adds the player height fix to a tracked position's height. |
private void Update() | Pushes the platform controller's input into this hand and updates the D-pad. |
private void UpdatePosition() | Just before rendering, asks the platform controller to update this hand's position. |
Used in
Members of other types that take, return or hold a PlayerInput:
AccessibleDocks.CheckInput, AccessibleDocks.StopInput, CosmeticCustomizationManager.ExitCustomizationRoom, CosmeticCustomizationManager.Randomize, Book.ClientMoveLeft, Book.ClientMoveRight, Book.ClientSwiped, QuickAccessMenuController.ButtonPress, QuickAccessMenuController.ButtonRelease, QuickAccessMenuController.ToggleButtonPress, HandCamera.EndHaptics, HandCamera.LongHaptic, HandCamera.longHaptics, HandCamera.Screenshot, HandCamera.StartHaptics, LiveDataDisplayView.ToggleFPSDisplay, AutoCamDeviceController.CreateController, BaseOpenXRInputController.BaseOpenXRInputController, CharacterPoseSaver.ButtonPressed, ClickedEndEventHandler.BeginInvoke, ClickedEndEventHandler.Invoke, ClickedEventHandler.BeginInvoke, ClickedEventHandler.Invoke, Controller.Initialize, Controller.PlayerInput, ControllerAction.AddInputAndListeners, ControllerAction.OnActionEnded, ControllerAction.OnActionStarted, ControllerAction.PopulateInputSourcePair, ControllerAction.RemoveAllInputsAndListeners, ControllerAction.RemoveInputsAndListeners, ControllerAction.SetInputAndListeners, ControllerActionProxy.InvokeEnded, ControllerActionProxy.InvokeStarted, ControllerActions.ControllerActions, ControllerActions.playerInput, ControllerActionsManager.playerInput, ControllerDPad.CalculateSwipe, ControllerDPad.ControllerDPad, ControllerDPad.PadTouched, ControllerDPad.playerInput, ControllerExtension.Input, ControllerInput.SetAndCallEvents, ControllerInputButtonPressed.ButtonPressed, DamageDebugDisplay.ToggleFPSDisplay, DeviceInputController.DeviceInputController, DeviceInputController.PlayerInput, DeviceInputController.SendInputTo, DmgTDisplay.ToggleFPSDisplay, DPadInputSource.DPadInputSource, DPadInputSource.playerInput, FlyCamDeviceController.CreateController, FlyCamHands.InvisibilityPressed, FlyCamHands.ModMuteMic, FlyCamHands.MuteOwnMic, FlyCamHands.SparkPressed, FlyCamInputController.FlyCamInputController, GenericOpenXRInputController.GenericOpenXRInputController, GrabAssistController.StartUpdatingGrabAssist, GrabAssistController.StopUpdatingGrabAssist and 67 more.