lvjincheng 4 роки тому
батько
коміт
913c9b1842

+ 95 - 0
Assets/BowArrow/Scenes/Game.unity

@@ -4984,6 +4984,100 @@ CanvasRenderer:
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 690906576}
   m_CullTransparentMesh: 0
+--- !u!1 &698090358
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 698090359}
+  - component: {fileID: 698090362}
+  - component: {fileID: 698090361}
+  - component: {fileID: 698090360}
+  m_Layer: 5
+  m_Name: RPY_LOG
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!224 &698090359
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 698090358}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_Children: []
+  m_Father: {fileID: 1979114040}
+  m_RootOrder: 10
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_AnchorMin: {x: 0, y: 0}
+  m_AnchorMax: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 30, y: 30}
+  m_SizeDelta: {x: 0, y: 0}
+  m_Pivot: {x: 0, y: 0}
+--- !u!114 &698090360
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 698090358}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_HorizontalFit: 2
+  m_VerticalFit: 2
+--- !u!114 &698090361
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 698090358}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_Material: {fileID: 0}
+  m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
+  m_RaycastTarget: 1
+  m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
+  m_Maskable: 1
+  m_OnCullStateChanged:
+    m_PersistentCalls:
+      m_Calls: []
+  m_FontData:
+    m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+    m_FontSize: 32
+    m_FontStyle: 0
+    m_BestFit: 0
+    m_MinSize: 3
+    m_MaxSize: 40
+    m_Alignment: 0
+    m_AlignByGeometry: 0
+    m_RichText: 1
+    m_HorizontalOverflow: 0
+    m_VerticalOverflow: 0
+    m_LineSpacing: 1
+  m_Text: "\u8C03\u8BD5\u4FE1\u606F\u8F93\u51FA"
+--- !u!222 &698090362
+CanvasRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 698090358}
+  m_CullTransparentMesh: 0
 --- !u!1 &707797764
 GameObject:
   m_ObjectHideFlags: 0
@@ -14949,6 +15043,7 @@ RectTransform:
   - {fileID: 1105832656}
   - {fileID: 1293471640}
   - {fileID: 1509022407}
+  - {fileID: 698090359}
   m_Father: {fileID: 0}
   m_RootOrder: 1
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

+ 6 - 2
Assets/BowArrow/Scripts/Bluetooth/BluetoothAim.cs

@@ -359,14 +359,18 @@ class AimHandler
     {
         if (hasAutoIdentity && controlObj != null)
         {
-            controlObj.transform.localRotation = Quaternion.Lerp(controlObj.transform.localRotation, newRotation, Time.deltaTime * 6);
+            controlObj.localRotation = Quaternion.Lerp(controlObj.localRotation, newRotation, Time.deltaTime * 6);
+            GameObject.Find("Canvas/RPY_LOG").GetComponent<Text>().text = 
+                "roll: " + controlObj.localEulerAngles.x +
+                "\npitch: " + controlObj.localEulerAngles.y +
+                "\nyaw: " + controlObj.localEulerAngles.z;
         }
         if (doIdentity)
         {
             _9Axis.SetIdentity();
             if (controlObj != null)
             {
-                controlObj.transform.localRotation = Quaternion.identity;
+                controlObj.localRotation = Quaternion.identity;
             }
             doIdentity = false;
             hasAutoIdentity = true;

+ 1 - 0
Assets/BowArrow/Scripts/Bluetooth/o09Axis.cs

@@ -443,5 +443,6 @@ public class o09Axis
         AccIdentity = AccOld;
         MagIdentity = MagOld;
         States.Last().Qua = Quaternion.identity;
+        States.Last().Variance = 0.0000001;
     }
 }