ViveInput.cs 981 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. playerReplay.Save();
  30. }
  31. if (grabGrib.GetStateDown(SteamVR_Input_Sources.Any))
  32. {
  33. playerReplay.Load();
  34. }
  35. }
  36. }