Browse Source

make ViveInput to trigger save and load joints

Kenkart 2 years ago
parent
commit
562dc69a05
3 changed files with 51 additions and 41 deletions
  1. 40 39
      Assets/Scenes/Main.unity
  2. 1 1
      Assets/Scripts/PlayerReplay.cs
  3. 10 1
      Assets/Scripts/ViveInput.cs

+ 40 - 39
Assets/Scenes/Main.unity

@@ -38,7 +38,7 @@ RenderSettings:
   m_ReflectionIntensity: 1
   m_CustomReflection: {fileID: 0}
   m_Sun: {fileID: 0}
-  m_IndirectSpecularColor: {r: 0.18264514, g: 0.22835582, b: 0.307145, a: 1}
+  m_IndirectSpecularColor: {r: 0.1826408, g: 0.2283514, b: 0.3071478, a: 1}
   m_UseRadianceAmbientProbe: 0
 --- !u!157 &3
 LightmapSettings:
@@ -251,11 +251,11 @@ PrefabInstance:
     - target: {fileID: 2348914, guid: 4d293c8e162f3874b982baadd71153d2, type: 3}
       propertyPath: m_Materials.Array.data[0]
       value: 
-      objectReference: {fileID: 444806043}
+      objectReference: {fileID: 786824142}
     - target: {fileID: 3380982, guid: 4d293c8e162f3874b982baadd71153d2, type: 3}
       propertyPath: m_Mesh
       value: 
-      objectReference: {fileID: 957242056}
+      objectReference: {fileID: 1454720341}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 4d293c8e162f3874b982baadd71153d2, type: 3}
 --- !u!4 &110216683 stripped
@@ -311,41 +311,6 @@ Transform:
   m_Father: {fileID: 0}
   m_RootOrder: 5
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
---- !u!21 &444806043
-Material:
-  serializedVersion: 6
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_Name: Sprites/Default
-  m_Shader: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
-  m_ShaderKeywords: 
-  m_LightmapFlags: 4
-  m_EnableInstancingVariants: 0
-  m_DoubleSidedGI: 0
-  m_CustomRenderQueue: -1
-  stringTagMap: {}
-  disabledShaderPasses: []
-  m_SavedProperties:
-    serializedVersion: 3
-    m_TexEnvs:
-    - _AlphaTex:
-        m_Texture: {fileID: 0}
-        m_Scale: {x: 1, y: 1}
-        m_Offset: {x: 0, y: 0}
-    - _MainTex:
-        m_Texture: {fileID: 0}
-        m_Scale: {x: 1, y: 1}
-        m_Offset: {x: 0, y: 0}
-    m_Floats:
-    - PixelSnap: 0
-    - _EnableExternalAlpha: 0
-    m_Colors:
-    - _Color: {r: 1, g: 1, b: 1, a: 1}
-    - _Flip: {r: 1, g: 1, b: 1, a: 1}
-    - _RendererColor: {r: 1, g: 1, b: 1, a: 1}
-  m_BuildTextureStacks: []
 --- !u!1 &573329778
 GameObject:
   m_ObjectHideFlags: 0
@@ -375,6 +340,7 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: 1e2211fa61ba0c84d8bc0e927c106fbc, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
+  playerReplay: {fileID: 65057765}
 --- !u!4 &573329780
 Transform:
   m_ObjectHideFlags: 0
@@ -389,6 +355,41 @@ Transform:
   m_Father: {fileID: 0}
   m_RootOrder: 8
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!21 &786824142
+Material:
+  serializedVersion: 6
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_Name: Sprites/Default
+  m_Shader: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
+  m_ShaderKeywords: 
+  m_LightmapFlags: 4
+  m_EnableInstancingVariants: 0
+  m_DoubleSidedGI: 0
+  m_CustomRenderQueue: -1
+  stringTagMap: {}
+  disabledShaderPasses: []
+  m_SavedProperties:
+    serializedVersion: 3
+    m_TexEnvs:
+    - _AlphaTex:
+        m_Texture: {fileID: 0}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    - _MainTex:
+        m_Texture: {fileID: 0}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    m_Floats:
+    - PixelSnap: 0
+    - _EnableExternalAlpha: 0
+    m_Colors:
+    - _Color: {r: 1, g: 1, b: 1, a: 1}
+    - _Flip: {r: 1, g: 1, b: 1, a: 1}
+    - _RendererColor: {r: 1, g: 1, b: 1, a: 1}
+  m_BuildTextureStacks: []
 --- !u!1001 &833043381
 PrefabInstance:
   m_ObjectHideFlags: 0
@@ -661,7 +662,7 @@ PrefabInstance:
       objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 4f35fa249b5008c44ac2998be6f82d4d, type: 3}
---- !u!43 &957242056
+--- !u!43 &1454720341
 Mesh:
   m_ObjectHideFlags: 0
   m_CorrespondingSourceObject: {fileID: 0}

+ 1 - 1
Assets/Scripts/PlayerReplay.cs

@@ -19,7 +19,7 @@ public class PlayerReplay : MonoBehaviour
 
         if(data == null)
         {
-            Debug.Log("Load failed");
+            Debug.LogError("Load failed");
             return;
         }
 

+ 10 - 1
Assets/Scripts/ViveInput.cs

@@ -5,7 +5,10 @@ using Valve.VR;
 
 public class ViveInput : MonoBehaviour
 {
+    public PlayerReplay playerReplay;
+
     private SteamVR_Action_Boolean grabPinch;
+    private SteamVR_Action_Boolean grabGrib;
 
 
     //private void Awake()
@@ -22,6 +25,7 @@ public class ViveInput : MonoBehaviour
     private void Start()
     {
         grabPinch = SteamVR_Actions.default_GrabPinch;
+        grabGrib = SteamVR_Actions.default_GrabGrip;
     }
 
     // Update is called once per frame
@@ -30,8 +34,13 @@ public class ViveInput : MonoBehaviour
         if (grabPinch.GetStateDown(SteamVR_Input_Sources.Any))
         {
             Debug.Log("grab pinch down");
+            playerReplay.Save();
         }
 
-        // TODO: other inputs
+        if (grabGrib.GetStateDown(SteamVR_Input_Sources.Any))
+        {
+            Debug.Log("grab grib down");
+            playerReplay.Load();
+        }
     }
 }