-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New way of doing vr input bindings, also adds stow button (#17)
* Add inputs debug * Trying new bindings way * Fix look * Better way, but also worse * I think maybe * Didn't help * Fix a bunch of bindings * Add stow binding
- Loading branch information
1 parent
696718d
commit ae86b7b
Showing
5 changed files
with
251 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,119 @@ | ||
namespace TwoForksVR.Input | ||
using System.Collections.Generic; | ||
|
||
namespace TwoForksVR.Input | ||
{ | ||
public struct InputName | ||
{ | ||
public const string Notes = "tab"; | ||
public const string Pause = "escape"; | ||
public const string Climb = "space"; | ||
public const string Jog = "r"; | ||
public const string Read = "q"; | ||
public const string Keep = "e"; | ||
public const string Map = "DPadVertical"; | ||
public const string Camera = "DPadHorizontal"; | ||
public const string Flashlight = "f"; | ||
public const string AltUse = "AltUse"; | ||
public const string BackwardKeyDown = "BackwardKeyDown"; | ||
public const string BackwardKeyUp = "BackwardKeyUp"; | ||
public const string Camera = "Camera"; | ||
public const string CompassZoomIn = "CompassZoomIn"; | ||
public const string CompassZoomOut = "CompassZoomOut"; | ||
public const string DemoTeleport = "DemoTeleport"; | ||
public const string DialogSelectionDown = "DialogSelectionDown"; | ||
public const string DialogSelectionDownOrUse = "DialogSelectionDownOrUse"; | ||
public const string DialogSelectionScroll = "DialogSelectionScroll"; | ||
public const string DialogSelectionUp = "DialogSelectionUp"; | ||
public const string DisplayInventory = "DisplayInventory"; | ||
public const string EquipCompass = "EquipCompass"; | ||
public const string EquipMap = "EquipMap"; | ||
public const string Flashlight = "Flashlight"; | ||
public const string ForwardKeyDown = "ForwardKeyDown"; | ||
public const string ForwardKeyUp = "ForwardKeyUp"; | ||
public const string HideInventory = "HideInventory"; | ||
public const string HorizontalMouse = "Horizontal_Mouse"; | ||
public const string HorizontalStick = "Horizontal_Stick"; | ||
public const string InventoryRotateHorizontal = "InventoryRotateHorizontal"; | ||
public const string InventoryRotateHorizontalStick = "InventoryRotateHorizontal_Stick"; | ||
public const string InventoryRotateVertical = "InventoryRotateVertical"; | ||
public const string InventoryRotateVerticalStick = "InventoryRotateVertical_Stick"; | ||
public const string InventoryZoomIn = "InventoryZoomIn"; | ||
public const string InventoryZoomInTrigger = "InventoryZoomInTrigger"; | ||
public const string Key0 = "Key0"; | ||
public const string Key1 = "Key1"; | ||
public const string Key2 = "Key2"; | ||
public const string Key3 = "Key3"; | ||
public const string Key4 = "Key4"; | ||
public const string Key5 = "Key5"; | ||
public const string Key6 = "Key6"; | ||
public const string Key7 = "Key7"; | ||
public const string Key8 = "Key8"; | ||
public const string Key9 = "Key9"; | ||
public const string Lean = "Lean"; | ||
public const string LeanDown = "LeanDown"; | ||
public const string LeanHorizontal = "LeanHorizontal"; | ||
public const string LeanLeft = "LeanLeft"; | ||
public const string LeanRight = "LeanRight"; | ||
public const string LeanUp = "LeanUp"; | ||
public const string LeanVertical = "LeanVertical"; | ||
public const string LockCancel = "LockCancel"; | ||
public const string LockNumberDown = "LockNumberDown"; | ||
public const string LockNumberUp = "LockNumberUp"; | ||
public const string LockTry = "LockTry"; | ||
public const string LockTumblerLeft = "LockTumblerLeft"; | ||
public const string LockTumblerRight = "LockTumblerRight"; | ||
public const string LocomotionAction = "LocomotionAction"; | ||
public const string LocomotionActionOrToggleJog = "LocomotionActionOrToggleJog"; | ||
public const string LocomotionActionRelease = "LocomotionActionRelease"; | ||
public const string LookHorizontalMouse = "LookHorizontal_Mouse"; | ||
public const string LookHorizontalStick = "LookHorizontal_Stick"; | ||
public const string LookVerticalMouse = "LookVertical_Mouse"; | ||
public const string LookVerticalStick = "LookVertical_Stick"; | ||
public const string MapZoomIn = "MapZoomIn"; | ||
public const string MapZoomOut = "MapZoomOut"; | ||
public const string MoveForward = "MoveForward"; | ||
public const string MoveStrafe = "MoveStrafe"; | ||
public const string LookVertical = "LookVertical_Stick"; | ||
public const string LookHorizontal = "LookHorizontal_Stick"; | ||
public const string ChooseDown = "down"; | ||
public const string Radio = "LeftTrigger"; | ||
public const string ChooseUp = "up"; | ||
public const string Zoom = "q"; | ||
public const string Interact = "mouse 0"; | ||
public const string NextPage = "e"; | ||
public const string PreviousPage = "q"; | ||
public const string NextMenu = "NextMenu"; | ||
public const string Pause = "Pause"; | ||
public const string PressDemoKey1 = "PressDemoKey1"; | ||
public const string PressDemoKey2 = "PressDemoKey2"; | ||
public const string PressDemoKey3 = "PressDemoKey3"; | ||
public const string PressDemoKey4 = "PressDemoKey4"; | ||
public const string PreviousMenu = "PreviousMenu"; | ||
public const string PutDownItem = "PutDownItem"; | ||
public const string QuickLoad = "QuickLoad"; | ||
public const string QuickSave = "QuickSave"; | ||
public const string RadioDown = "RadioDown"; | ||
public const string RadioUp = "RadioUp"; | ||
public const string ReadMode = "ReadMode"; | ||
public const string Scroll = "Scroll"; | ||
public const string StartInventoryRotation = "StartInventoryRotation"; | ||
public const string StopInventoryRotation = "StopInventoryRotation"; | ||
public const string StopLean = "StopLean"; | ||
public const string StopStowHeldObject = "StopStowHeldObject"; | ||
public const string StowHeldObject = "StowHeldObject"; | ||
public const string StrafeLeftKeyDown = "StrafeLeftKeyDown"; | ||
public const string StrafeLeftKeyUp = "StrafeLeftKeyUp"; | ||
public const string StrafeRightKeyDown = "StrafeRightKeyDown"; | ||
public const string StrafeRightKeyUp = "StrafeRightKeyUp"; | ||
public const string Titlecard = "Titlecard"; | ||
public const string ToggleCompass = "ToggleCompass"; | ||
public const string ToggleJog = "ToggleJog"; | ||
public const string ToggleMap = "ToggleMap"; | ||
public const string ToggleReading = "ToggleReading"; | ||
public const string TossItem = "TossItem"; | ||
public const string UICancel = "UICancel"; | ||
public const string UISubmit = "UISubmit"; | ||
public const string UIClick = "UIClick"; | ||
public const string UILeft = "UILeft"; | ||
public const string UIRight = "UIRight"; | ||
public const string UIUp = "UIUp"; | ||
public const string UIDown = "UIDown"; | ||
public const string UIVertical = "UIVertical"; | ||
public const string UIHorizontal = "UIHorizontal"; | ||
public const string UnCrouch = "UnCrouch"; | ||
public const string UnequipCompass = "UnequipCompass"; | ||
public const string UnequipMap = "UnequipMap"; | ||
public const string UnPause = "UnPause"; | ||
public const string Use = "Use"; | ||
public const string UseCamera = "UseCamera"; | ||
public const string VerticalMouse = "Vertical_Mouse"; | ||
public const string VerticalStick = "Vertical_Stick"; | ||
public const string WindUpToss = "WindUpToss"; | ||
public const string ZoomIn = "ZoomIn"; | ||
public const string ZoomInOnHeldObject = "ZoomInOnHeldObject"; | ||
public const string ZoomOut = "ZoomOut"; | ||
public const string ZoomOutOnHeldObject = "ZoomOutOnHeldObject"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace TwoForksVR.Input | ||
{ | ||
public class VrAxisData : vgKeyData | ||
{ | ||
public VrAxisData(string name, float deadzone = 0.5f) | ||
{ | ||
names = new List<string>(1); | ||
names.Add(name); | ||
buttonDeadzone = deadzone; | ||
} | ||
|
||
public override void Update() | ||
{ | ||
axisValueLastFrame = axisValue; | ||
string axisName = names[0]; | ||
axisValue = UnityEngine.Input.GetAxisRaw(axisName); | ||
} | ||
|
||
public override bool Released() | ||
{ | ||
return CheckThreshold(buttonDeadzone) == ThresholdResult.CrossedBelow; | ||
} | ||
|
||
public override bool Pressed() | ||
{ | ||
return CheckThreshold(buttonDeadzone) == ThresholdResult.CrossedAbove; | ||
} | ||
|
||
public override bool IsHeld() | ||
{ | ||
return GetAxisValue() >= buttonDeadzone; | ||
} | ||
|
||
public override bool ShouldHold(float duration) | ||
{ | ||
return false; | ||
} | ||
|
||
public override float GetAxisValue() | ||
{ | ||
return axisValue; | ||
} | ||
|
||
public override float GetPreviousAxisValue() | ||
{ | ||
return axisValueLastFrame; | ||
} | ||
|
||
public override vgKeyCodeToVirtualKey.KeyType GetKeyType() | ||
{ | ||
return vgKeyCodeToVirtualKey.KeyType.Axis; | ||
} | ||
|
||
private float axisValue; | ||
|
||
private float axisValueLastFrame; | ||
|
||
private float buttonDeadzone = 0.5f; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters