InputDeviceGGT26Dof.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. using AOT;
  2. using SC.XR.Unity.Module_Device;
  3. using SC.XR.Unity.Module_InputSystem.InputDeviceGC;
  4. using System;
  5. using System.Collections;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Runtime.InteropServices;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using UnityEngine;
  12. namespace SC.XR.Unity.Module_InputSystem.InputDeviceHand.GGT26Dof
  13. {
  14. public class InputDeviceGGT26Dof : InputDeviceHand
  15. {
  16. public override InputDeviceType inputDeviceType
  17. {
  18. get
  19. {
  20. return InputDeviceType.GGT26Dof;
  21. }
  22. }
  23. [HideInInspector]
  24. public float LowPowerPercent = 15;
  25. private Coroutine lowPowerCoroutine = null;
  26. bool isHandTrackStart = false;
  27. Coroutine startHand;
  28. [MonoPInvokeCallback(typeof(Action))]
  29. public static void GestureModelDataChangeCallback()
  30. {
  31. //Debug.Log("[04]GestureModelDataChangeCallback start");
  32. //InputDeviceGGT26DofPart inputDeviceGGT26DofPart = (inputDevicePartList[0] as InputDeviceGGT26DofPart);
  33. //if (inputDeviceGGT26DofPart != null) {
  34. // inputDeviceGGT26DofPart.inputDataGetGGT26Dof.inputDataGetHandsData.OnUpdateInputDataAndStore();
  35. //}
  36. }
  37. protected override void InputDeviceStart(){
  38. StartHandTrack();
  39. }
  40. public override void OnSCUpdate() {
  41. base.OnSCUpdate();
  42. if (isHandTrackStart) {
  43. if (Application.platform == RuntimePlatform.Android) {
  44. API_GSXR_Slam.SlamManager.plugin.GSXR_Get_HandTrackingData(InputDataGGT26Dof.handsInfo.originDataMode, InputDataGGT26Dof.handsInfo.originDataPose);
  45. }else {
  46. HANDTRACK_GetHand_PC(out InputDataGGT26Dof.handsInfo.originDataMode, out InputDataGGT26Dof.handsInfo.originDataPose);
  47. }
  48. }
  49. }
  50. public override void OnSCLateUpdate()
  51. {
  52. base.OnSCLateUpdate();
  53. if (lowPowerTrigger)
  54. {
  55. DebugMy.Log("ScHANDTRACK_lowPowerTrigger", this, true);
  56. lowPowerTrigger = false;
  57. if (lowPowerCoroutine == null)
  58. {
  59. lowPowerCoroutine = StartCoroutine(LowPowerFunction());
  60. }
  61. }
  62. }
  63. IEnumerator LowPowerFunction(float loopTime = 3)
  64. {
  65. StopHandTrack();
  66. SetActiveInputDevicePart(InputDevicePartType.HandLeft, false);
  67. SetActiveInputDevicePart(InputDevicePartType.HandRight, false);
  68. while (loopTime-- > 0)
  69. {
  70. if (inputDeviceUI as InputDeviceHandUI)
  71. {
  72. (inputDeviceUI as InputDeviceHandUI).SetActiveUI(HandUIType.LOWPOWER, true);
  73. }
  74. yield return null;
  75. yield return new WaitForSeconds(12);
  76. }
  77. lowPowerCoroutine = null;
  78. }
  79. IEnumerator StartGreyHand()
  80. {
  81. yield return new WaitUntil(() => API_GSXR_Slam.SlamManager != null);
  82. yield return new WaitUntil(() => API_GSXR_Slam.SlamManager.IsRunning == true);
  83. if (API_GSXR_Slam.SlamManager.plugin.GSXR_Is_SupportHandTracking() == false) {
  84. DebugMy.Log("Not Support HandTracking",this,true);
  85. yield break;
  86. }
  87. if (DeviceInfo.BatteryLevel < LowPowerPercent) {
  88. if (lowPowerCoroutine == null) {
  89. lowPowerCoroutine = StartCoroutine(LowPowerFunction());
  90. }
  91. DebugMy.Log("BatteryLevel < " + LowPowerPercent + " StopHandTrack", this, true);
  92. yield break;
  93. }
  94. PermissionRequest.getInstance.GetPerssion(UnityEngine.Android.Permission.ExternalStorageRead);
  95. PermissionRequest.getInstance.GetPerssion(UnityEngine.Android.Permission.ExternalStorageWrite);
  96. if (isHandTrackStart == false) {
  97. isHandTrackStart = true;
  98. DebugMy.Log("ScHANDTRACK_Start", this, true);
  99. if (Application.platform == RuntimePlatform.Android) {
  100. try {
  101. API_GSXR_Slam.SlamManager.plugin.GSXR_StartHandTracking(LowPowerWarningCallback);
  102. API_GSXR_Slam.SlamManager.plugin.GSXR_Set_HandTrackingCallBack(GestureChangeCallback);
  103. API_GSXR_Slam.SlamManager.plugin.GSXR_Set_HandTrackingModelDataCallBack(GestureModelDataChangeCallback);
  104. } catch (Exception e) {
  105. Debug.Log(e);
  106. }
  107. }
  108. }
  109. startHand = null;
  110. base.InputDeviceStart();
  111. }
  112. public override void OnSCDisable()
  113. {
  114. base.OnSCDisable();
  115. StopHandTrack();
  116. }
  117. private void StartHandTrack() {
  118. if (startHand == null) {
  119. startHand = StartCoroutine(StartGreyHand());
  120. }
  121. }
  122. private void StopHandTrack() {
  123. if (startHand != null) {
  124. StopCoroutine(startHand);
  125. startHand = null;
  126. }
  127. if (isHandTrackStart) {
  128. isHandTrackStart = false;
  129. DebugMy.Log("ScHANDTRACK_Stop", this, true);
  130. if (Application.platform == RuntimePlatform.Android) {
  131. try {
  132. API_GSXR_Slam.SlamManager.plugin.GSXR_StopHandTracking();
  133. } catch (Exception e) {
  134. Debug.Log(e);
  135. }
  136. }
  137. }
  138. }
  139. //{1, "THUMB"},
  140. //{2, "ONE"},
  141. //{3, "TWO"},
  142. //{4, "THREE"},
  143. //{5, "FOUR"},
  144. //{6, "FIVE"},
  145. //{7, "OK"},
  146. //{8, "DIRECTION"},
  147. [MonoPInvokeCallback(typeof(Action<int>))]
  148. public static void GestureChangeCallback(int gesture)
  149. {
  150. Debug.Log("GestureChangeCallback, gesture id:" + gesture);
  151. }
  152. static bool lowPowerTrigger = false;
  153. [MonoPInvokeCallback(typeof(Action<int>))]
  154. public static void LowPowerWarningCallback(int power)
  155. {
  156. Debug.Log("HandGesture Cannot work in low power state:" + power);
  157. lowPowerTrigger = true;
  158. }
  159. float[] DataLeftCatch = new float[256] {
  160. 2f,
  161. 1f,
  162. 21f,
  163. -0.05605574f , -0.0273f , 0.314f,
  164. -0.07f , -0.0447f , 0.3f ,
  165. -0.09515104f , -0.05433898f , 0.2831757f,
  166. -0.1463438f , -0.06028023f , 0.2818089f,
  167. -0.0519f , -0.0216f , 0.3217f,
  168. -0.06158409f , -0.0002f , 0.3183799f,
  169. -0.07964747f , 0.0028f , 0.3071041f,
  170. -0.09945723f , -0.008320909f , 0.2969252f,
  171. -0.06198902f , -0.0038f , 0.3519928f ,
  172. -0.07581183f , 0.0061f , 0.3419357f ,
  173. -0.09352214f , 0.0082f , 0.3285346f ,
  174. -0.1137585f , -0.002121262f , 0.3150989f,
  175. -0.07718303f , -0.0063f , 0.364556f,
  176. -0.08849367f , 0.0018f , 0.3556355f,
  177. -0.1056515f , 0.0004f , 0.3442511f,
  178. -0.1236217f , -0.008046876f , 0.331872f,
  179. -0.09772705f , -0.0135f , 0.3714658f,
  180. -0.1064803f , -0.0118f , 0.3659644f,
  181. -0.1201454f , -0.0166f , 0.3570033f ,
  182. -0.1347919f , -0.02225832f , 0.3441104f,
  183. -0.1562702f , -0.05975028f , 0.2943733f ,
  184. 2f,
  185. 21f,
  186. 0.01329147f , -0.05185008f , 0.2831516f,
  187. 0.02629676f , -0.05859572f , 0.2733593f ,
  188. 0.04144813f , -0.06611566f , 0.2669144f,
  189. 0.09289996f , -0.07803007f , 0.2608919f,
  190. 0.008512383f , 0.008053687f , 0.2999706f,
  191. 0.0184048f , 0.004125214f , 0.2896651f ,
  192. 0.0309000f , -0.00680000f , 0.27900000f ,
  193. 0.05151144f , -0.02237571f , 0.2674141f,
  194. 0.02381282f , 0.02699578f , 0.3218553f,
  195. 0.03562622f , 0.01996369f , 0.3106135f,
  196. 0.05122653f , 0.008665001f , 0.2939393f,
  197. 0.06585947f , -0.01085604f , 0.2825926f,
  198. 0.04237749f , 0.01809751f , 0.3312246f ,
  199. 0.05178002f , 0.01224715f , 0.3221904f,
  200. 0.0659532f , 0.003831701f , 0.3083498f,
  201. 0.07914048f , -0.01247946f , 0.296542f,
  202. 0.06218155f , 0.002945414f , 0.3410454f ,
  203. 0.07016665f , -0.002003442f , 0.3339252f,
  204. 0.08204032f , -0.01003692f , 0.322701f,
  205. 0.09209882f , -0.02350484f , 0.3101943f ,
  206. 0.1055621f , -0.07391939f , 0.2699004f ,
  207. 0,
  208. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  209. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  210. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  211. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  212. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  213. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  214. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  215. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  216. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  217. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  218. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  219. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  220. 0,0,0,0
  221. };
  222. float[] DataRightCatch = new float[256] {
  223. 2f,
  224. 1f,
  225. 21f,
  226. -0.05605574f , -0.04518472f , 0.2970701f,
  227. -0.07650252f , -0.04899639f , 0.2892286f ,
  228. -0.09515104f , -0.05433898f , 0.2831757f,
  229. -0.1463438f , -0.06028023f , 0.2818089f,
  230. -0.04933745f , 0.01041036f , 0.3268114f,
  231. -0.06158409f , 0.009036704f , 0.3183799f,
  232. -0.07964747f , 0.0015f , 0.3071041f,
  233. -0.09945723f , -0.008320909f , 0.2969252f,
  234. -0.06198902f , 0.02461821f , 0.3519928f ,
  235. -0.07581183f , 0.02041251f , 0.3419357f ,
  236. -0.09352214f , 0.01374155f , 0.3285346f ,
  237. -0.1137585f , -0.002121262f , 0.3150989f,
  238. -0.07718303f , 0.01460867f , 0.364556f,
  239. -0.08849367f , 0.01155128f , 0.3556355f,
  240. -0.1056515f , 0.005635553f , 0.3442511f,
  241. -0.1236217f , -0.008046876f , 0.331872f,
  242. -0.09772705f , -0.003397862f , 0.3714658f,
  243. -0.1064803f , -0.005923742f , 0.3659644f,
  244. -0.1201454f , -0.01133183f , 0.3570033f ,
  245. -0.1347919f , -0.02225832f , 0.3441104f,
  246. -0.1562702f , -0.05975028f , 0.2943733f ,
  247. 2f,
  248. 21f,
  249. 0.0159f , -0.0299f , 0.2831516f,
  250. 0.0348f , -0.0511f , 0.2733593f ,
  251. 0.0491f , -0.0602f , 0.2669144f,
  252. 0.09289996f , -0.07803007f , 0.2608919f,
  253. 0.0085f , -0.0223f , 0.2917f,
  254. 0.0184f , -0.0117f , 0.28966f ,
  255. 0.0338265f , -0.0106f , 0.2750752f ,
  256. 0.05151144f , -0.02237571f , 0.2674141f,
  257. 0.02381282f , -0.005f , 0.3218553f,
  258. 0.03562622f , 0.0052f , 0.3106135f,
  259. 0.05122653f , 0.0032f , 0.2939393f,
  260. 0.06585947f , -0.01085604f , 0.2825926f,
  261. 0.04237749f , 0.002f , 0.3312246f ,
  262. 0.05178002f , 0.0005f , 0.3221904f,
  263. 0.0659532f , -0.002f , 0.3083498f,
  264. 0.07914048f , -0.01247946f , 0.296542f,
  265. 0.06218155f , 0.002945414f , 0.3410454f ,
  266. 0.07016665f , -0.002003442f , 0.3339252f,
  267. 0.08204032f , -0.01003692f , 0.322701f,
  268. 0.09209882f , -0.02350484f , 0.3101943f ,
  269. 0.1055621f , -0.07391939f , 0.2699004f ,
  270. 0,
  271. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  272. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  273. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  274. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  275. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  276. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  277. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  278. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  279. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  280. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  281. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  282. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  283. 0,0,0,0
  284. };
  285. float[] DataBothCatch = new float[256] {
  286. 2f,
  287. 1f,
  288. 21f,
  289. -0.05605574f , -0.0273f , 0.314f,
  290. -0.07f , -0.0447f , 0.3f ,
  291. -0.09515104f , -0.05433898f , 0.2831757f,
  292. -0.1463438f , -0.06028023f , 0.2818089f,
  293. -0.0519f , -0.0216f , 0.3217f,
  294. -0.06158409f , -0.0002f , 0.3183799f,
  295. -0.07964747f , 0.0028f , 0.3071041f,
  296. -0.09945723f , -0.008320909f , 0.2969252f,
  297. -0.06198902f , -0.0038f , 0.3519928f ,
  298. -0.07581183f , 0.0061f , 0.3419357f ,
  299. -0.09352214f , 0.0082f , 0.3285346f ,
  300. -0.1137585f , -0.002121262f , 0.3150989f,
  301. -0.07718303f , -0.0063f , 0.364556f,
  302. -0.08849367f , 0.0018f , 0.3556355f,
  303. -0.1056515f , 0.0004f , 0.3442511f,
  304. -0.1236217f , -0.008046876f , 0.331872f,
  305. -0.09772705f , -0.0135f , 0.3714658f,
  306. -0.1064803f , -0.0118f , 0.3659644f,
  307. -0.1201454f , -0.0166f , 0.3570033f ,
  308. -0.1347919f , -0.02225832f , 0.3441104f,
  309. -0.1562702f , -0.05975028f , 0.2943733f ,
  310. 2f,
  311. 21f,
  312. 0.0159f , -0.0299f , 0.2831516f,
  313. 0.0348f , -0.0511f , 0.2733593f ,
  314. 0.0491f , -0.0602f , 0.2669144f,
  315. 0.09289996f , -0.07803007f , 0.2608919f,
  316. 0.0085f , -0.0223f , 0.2917f,
  317. 0.0184f , -0.0117f , 0.28966f ,
  318. 0.0338265f , -0.0106f , 0.2750752f ,
  319. 0.05151144f , -0.02237571f , 0.2674141f,
  320. 0.02381282f , -0.005f , 0.3218553f,
  321. 0.03562622f , 0.0052f , 0.3106135f,
  322. 0.05122653f , 0.0032f , 0.2939393f,
  323. 0.06585947f , -0.01085604f , 0.2825926f,
  324. 0.04237749f , 0.002f , 0.3312246f ,
  325. 0.05178002f , 0.0005f , 0.3221904f,
  326. 0.0659532f , -0.002f , 0.3083498f,
  327. 0.07914048f , -0.01247946f , 0.296542f,
  328. 0.06218155f , 0.002945414f , 0.3410454f ,
  329. 0.07016665f , -0.002003442f , 0.3339252f,
  330. 0.08204032f , -0.01003692f , 0.322701f,
  331. 0.09209882f , -0.02350484f , 0.3101943f ,
  332. 0.1055621f , -0.07391939f , 0.2699004f ,
  333. 0,
  334. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  335. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  336. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  337. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  338. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  339. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  340. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  341. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  342. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  343. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  344. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  345. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  346. 0,0,0,0
  347. };
  348. float[] DataBothRelease = new float[256] {
  349. 2f,
  350. 1f,
  351. 21f,
  352. -0.05605574f , -0.04518472f , 0.2970701f,
  353. -0.07650252f , -0.04899639f , 0.2892286f ,
  354. -0.09515104f , -0.05433898f , 0.2831757f,
  355. -0.1463438f , -0.06028023f , 0.2818089f,
  356. -0.04933745f , 0.01041036f , 0.3268114f,
  357. -0.06158409f , 0.009036704f , 0.3183799f,
  358. -0.07964747f , 0.0015f , 0.3071041f,
  359. -0.09945723f , -0.008320909f , 0.2969252f,
  360. -0.06198902f , 0.02461821f , 0.3519928f ,
  361. -0.07581183f , 0.02041251f , 0.3419357f ,
  362. -0.09352214f , 0.01374155f , 0.3285346f ,
  363. -0.1137585f , -0.002121262f , 0.3150989f,
  364. -0.07718303f , 0.01460867f , 0.364556f,
  365. -0.08849367f , 0.01155128f , 0.3556355f,
  366. -0.1056515f , 0.005635553f , 0.3442511f,
  367. -0.1236217f , -0.008046876f , 0.331872f,
  368. -0.09772705f , -0.003397862f , 0.3714658f,
  369. -0.1064803f , -0.005923742f , 0.3659644f,
  370. -0.1201454f , -0.01133183f , 0.3570033f ,
  371. -0.1347919f , -0.02225832f , 0.3441104f,
  372. -0.1562702f , -0.05975028f , 0.2943733f ,
  373. 2f,
  374. 21f,
  375. 0.01329147f , -0.05185008f , 0.2831516f,
  376. 0.02629676f , -0.05859572f , 0.2733593f ,
  377. 0.04144813f , -0.06611566f , 0.2669144f,
  378. 0.09289996f , -0.07803007f , 0.2608919f,
  379. 0.008512383f , 0.008053687f , 0.2999706f,
  380. 0.0184048f , 0.004125214f , 0.2896651f ,
  381. 0.0309000f , -0.00680000f , 0.27900000f ,
  382. 0.05151144f , -0.02237571f , 0.2674141f,
  383. 0.02381282f , 0.02699578f , 0.3218553f,
  384. 0.03562622f , 0.01996369f , 0.3106135f,
  385. 0.05122653f , 0.008665001f , 0.2939393f,
  386. 0.06585947f , -0.01085604f , 0.2825926f,
  387. 0.04237749f , 0.01809751f , 0.3312246f ,
  388. 0.05178002f , 0.01224715f , 0.3221904f,
  389. 0.0659532f , 0.003831701f , 0.3083498f,
  390. 0.07914048f , -0.01247946f , 0.296542f,
  391. 0.06218155f , 0.002945414f , 0.3410454f ,
  392. 0.07016665f , -0.002003442f , 0.3339252f,
  393. 0.08204032f , -0.01003692f , 0.322701f,
  394. 0.09209882f , -0.02350484f , 0.3101943f ,
  395. 0.1055621f , -0.07391939f , 0.2699004f ,
  396. 0,
  397. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  398. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  399. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  400. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  401. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  402. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  403. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  404. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  405. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  406. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  407. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  408. 0,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
  409. 0,0,0,0
  410. };
  411. float[] poseNull = new float[3] { 0, 0, 0 };
  412. protected virtual int HANDTRACK_GetHand_PC(out float[] model, out float[] pose)
  413. {
  414. pose = poseNull;
  415. #region PCgesture
  416. if (Input.GetKey(KeyCode.Alpha1) == true && Input.GetKey(KeyCode.Alpha2) == false)
  417. {
  418. ///左手抓取手型数据
  419. model = DataLeftCatch;
  420. }
  421. else if ((Input.GetKey(KeyCode.Alpha1) == false && Input.GetKey(KeyCode.Alpha2)) == true)
  422. {
  423. ///右手手抓取手型数据
  424. model = DataRightCatch;
  425. }
  426. else if (Input.GetMouseButton(0) || Input.GetKey(KeyCode.Alpha1) == true && Input.GetKey(KeyCode.Alpha2) == true)
  427. {
  428. ///双手抓取手型数据
  429. model = DataBothCatch;
  430. }
  431. else
  432. {
  433. ///正常张开手型数据
  434. model = DataBothRelease;
  435. }
  436. #endregion
  437. //if(Input.GetKey(KeyCode.W) == true) {
  438. // temp +=Vector3.forward* Time.deltaTime * 0.1f;
  439. //}
  440. //if(Input.GetKey(KeyCode.A) == true) {
  441. // temp += Vector3.left * Time.deltaTime * 0.1f;
  442. //}
  443. //if(Input.GetKey(KeyCode.D) == true) {
  444. // temp += Vector3.right * Time.deltaTime * 0.1f;
  445. //}
  446. //if(Input.GetKey(KeyCode.S) == true) {
  447. // temp += Vector3.back * Time.deltaTime * 0.1f;
  448. //}
  449. //pose[0] = temp.x;
  450. //pose[1] = temp.y;
  451. //pose[2] = temp.z;
  452. return 0;
  453. }
  454. }
  455. }