ViveInput.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Valve.VR;
  5. public class ViveInput : MonoBehaviour
  6. {
  7. public PlayerReplay playerReplay;
  8. private SteamVR_Action_Boolean grabPinch;
  9. private SteamVR_Action_Boolean grabGrib;
  10. //private void Awake()
  11. //{
  12. // actionBoolean = SteamVR_Actions._default.GrabPinch;
  13. //}
  14. //// Start is called before the first frame update
  15. //void Start()
  16. //{
  17. // actionSet.Activate(SteamVR_Input_Sources.Any, 0, true);
  18. //}
  19. private void Start()
  20. {
  21. grabPinch = SteamVR_Actions.default_GrabPinch;
  22. grabGrib = SteamVR_Actions.default_GrabGrip;
  23. }
  24. // Update is called once per frame
  25. void Update()
  26. {
  27. if (grabPinch.GetStateDown(SteamVR_Input_Sources.Any))
  28. {
  29. Debug.Log("grab pinch down");
  30. playerReplay.Save();
  31. }
  32. if (grabGrib.GetStateDown(SteamVR_Input_Sources.Any))
  33. {
  34. Debug.Log("grab grib down");
  35. playerReplay.Load();
  36. }
  37. }
  38. }