12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using Valve.VR;
- public class ViveInput : MonoBehaviour
- {
- public PlayerReplay playerReplay;
- public BodySourceView bsv;
- private SteamVR_Action_Boolean grabPinch;
- private SteamVR_Action_Boolean grabGrib;
- private SteamVR_Action_Boolean teleport;
- //private SteamVR_Action_Vector2 trackpad;
- private bool isRecording;
- private float recordingTime;
- private void Start()
- {
- grabPinch = SteamVR_Actions.default_GrabPinch;
- grabGrib = SteamVR_Actions.default_GrabGrip;
- teleport = SteamVR_Actions.default_Teleport;
- }
- void Update()
- {
- if (grabPinch.GetStateDown(SteamVR_Input_Sources.Any))
- {
-
- }
- if (teleport.GetStateDown(SteamVR_Input_Sources.Any))
- {
- if (!isRecording)
- {
- Debug.Log("Recording...");
- isRecording = true;
- } else
- {
- Debug.Log("Saving...");
- isRecording = false;
- recordingTime = 0;
- playerReplay.Save();
- playerReplay.ResetRecording();
- }
- }
- if (grabGrib.GetStateDown(SteamVR_Input_Sources.Any))
- {
- Debug.Log("Loading...");
- playerReplay.Load();
- }
- if (isRecording)
- {
- playerReplay.AddJoints(recordingTime);
- recordingTime += Time.deltaTime;
- }
- }
- }
|