HandVisualization.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. using EZXR.Glass.Core;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. namespace EZXR.Glass.Inputs
  7. {
  8. /// <summary>
  9. /// 可视化手部信息:关节、关节点等等
  10. /// </summary>
  11. [ScriptExecutionOrder(-48)]
  12. public class HandVisualization : MonoBehaviour
  13. {
  14. bool visibility = true;
  15. bool lastVisibility = true;
  16. /// <summary>
  17. /// 是否显示球棍手
  18. /// </summary>
  19. public bool ShowHandJoint = true;
  20. public bool ShowHandJointAxis = true;
  21. /// <summary>
  22. /// 是否启用手部物理碰撞
  23. /// </summary>
  24. [HideInInspector]
  25. public bool enablePhysicsInteraction;
  26. string[] jointNames;
  27. #region 变量声明,3D球棍模型展示
  28. /// <summary>
  29. /// 这个其实是眼镜的RGB相机焦点与人眼焦点的固定偏移量,加了这个偏移之后展示的球棍还有射线等等的模型才能和真实的手贴合
  30. /// </summary>
  31. Vector3 fixedOffset = new Vector3(0, 0.025f, 0.075f);
  32. /// <summary>
  33. /// 手指关节点的prefab
  34. /// </summary>
  35. [HideInInspector]
  36. public GameObject prefab_Keypoint;
  37. [HideInInspector]
  38. public GameObject prefab_Axis;
  39. /// <summary>
  40. /// 手指关节prefab的实例,每个手25个点,用于展示3d关节点,0是拇指根节点,3号是拇指指尖,7是是食指指尖
  41. /// </summary>
  42. [HideInInspector]
  43. public Transform[] keyPoints = new Transform[25];
  44. [HideInInspector]
  45. public Transform[] keyPoints_Axis = new Transform[25];
  46. /// <summary>
  47. /// 手指关节的prefab
  48. /// </summary>
  49. [HideInInspector]
  50. public GameObject prefab_FingerBone;
  51. #endregion
  52. #region 变量声明,2D球棍显示
  53. /// <summary>
  54. /// 关节点的prefab
  55. /// </summary>
  56. GameObject prefab_Keypoint2D;
  57. /// <summary>
  58. /// 关节线的prefab
  59. /// </summary>
  60. GameObject prefab_FingerBone2D;
  61. #endregion
  62. #region 变量声明,手部射线展示
  63. ///// <summary>
  64. ///// 记录了右手的所有信息,包括当前有没有捏合,有没有握持物体等等
  65. ///// </summary>
  66. //[HideInInspector]
  67. //public HandInfo handInfo_Right;
  68. #endregion
  69. HandInfo handInfo;
  70. [HideInInspector]
  71. public Dictionary<int, Transform> fingerBones = new Dictionary<int, Transform>();
  72. #region 变量声明,灰度相关
  73. /// <summary>
  74. /// 左灰度相机的左手关节点的信息
  75. /// </summary>
  76. RectTransform[] keyPoints2D_LeftFish_LeftHand = new RectTransform[21];
  77. /// <summary>
  78. /// 左灰度相机的右手关节点的信息
  79. /// </summary>
  80. RectTransform[] keyPoints2D_LeftFish_RightHand = new RectTransform[21];
  81. /// <summary>
  82. /// 右灰度相机的左手关节点的信息
  83. /// </summary>
  84. RectTransform[] keyPoints2D_RightFish_LeftHand = new RectTransform[21];
  85. /// <summary>
  86. /// 右灰度相机的右手关节点的信息
  87. /// </summary>
  88. RectTransform[] keyPoints2D_RightFish_RightHand = new RectTransform[21];
  89. /// <summary>
  90. /// 左灰度相机的左手关节线的信息
  91. /// </summary>
  92. Dictionary<int, RectTransform> fingerBones2D_LeftFish_LeftHand = new Dictionary<int, RectTransform>();
  93. /// <summary>
  94. /// 左灰度相机的右手关节线的信息
  95. /// </summary>
  96. Dictionary<int, RectTransform> fingerBones2D_LeftFish_RightHand = new Dictionary<int, RectTransform>();
  97. /// <summary>
  98. /// 右灰度相机的左手关节线的信息
  99. /// </summary>
  100. Dictionary<int, RectTransform> fingerBones2D_RightFish_LeftHand = new Dictionary<int, RectTransform>();
  101. /// <summary>
  102. /// 右灰度相机的右手关节线的信息
  103. /// </summary>
  104. Dictionary<int, RectTransform> fingerBones2D_RightFish_RightHand = new Dictionary<int, RectTransform>();
  105. /// <summary>
  106. /// 左灰度相机图像上用于绘制关节点和关节线的物体
  107. /// </summary>
  108. Transform canvasRoot_Left;
  109. /// <summary>
  110. /// 右灰度相机图像上用于绘制关节点和关节线的物体
  111. /// </summary>
  112. Transform canvasRoot_Right;
  113. #endregion
  114. private void Awake()
  115. {
  116. //得到所有关节点的名字
  117. jointNames = System.Enum.GetNames(typeof(HandJointType));
  118. handInfo = GetComponent<HandInfo>();
  119. prefab_Keypoint = ResourcesManager.Load<GameObject>("KeyPoint/KeyPoint");
  120. if (ShowHandJointAxis)
  121. {
  122. prefab_Axis = ResourcesManager.Load<GameObject>("KeyPoint/Axis");
  123. }
  124. prefab_FingerBone = ResourcesManager.Load<GameObject>("FingerBone/FingerBone");
  125. prefab_Keypoint2D = ResourcesManager.Load<GameObject>("KeyPoint/KeyPoint_2D");
  126. prefab_FingerBone2D = ResourcesManager.Load<GameObject>("FingerBone/FingerBone_2D");
  127. //prefab_RigidbodyForCollision = ResourcesManager.Load<GameObject>("Collision/KeyPointRigidbody");
  128. }
  129. public bool Visibility
  130. {
  131. get
  132. {
  133. return visibility;
  134. }
  135. set
  136. {
  137. visibility = value;
  138. //这里直接调用Show会出现keyPoints数组虽然长度为25,但是每个元素都是"null",非常神奇的bug,只要从其他脚本中调用Visibility中的Show来隐藏球棍手就一定会出现这个问题,所以改为了在此脚本的update中调用Show
  139. //Show(value);
  140. }
  141. }
  142. public void Show(bool value)
  143. {
  144. //Debug.Log("HandsVisualization jointNames.Length " + jointNames.Length);
  145. for (int id = 0; id < jointNames.Length; id++)
  146. {
  147. if (keyPoints != null && keyPoints.Length > 0)
  148. {
  149. //Debug.Log("HandsVisualization hide " + id + ", " + value.ToString());
  150. keyPoints[id].GetComponent<MeshRenderer>().enabled = value;
  151. }
  152. if (ShowHandJointAxis)
  153. {
  154. if (keyPoints_Axis != null && keyPoints_Axis.Length > 0)
  155. {
  156. keyPoints_Axis[id].gameObject.SetActive(value);
  157. }
  158. }
  159. if (id > 0)
  160. {
  161. if (fingerBones.ContainsKey(id))
  162. {
  163. if (fingerBones != null && fingerBones.Count > 0)
  164. {
  165. fingerBones[id].gameObject.SetActive(value);
  166. }
  167. }
  168. }
  169. }
  170. }
  171. // Start is called before the first frame update
  172. void Start()
  173. {
  174. #region 3D展示
  175. //实例化所有关节点(球棍型可视化用)
  176. for (int i = 0; i < jointNames.Length; i++)
  177. {
  178. keyPoints[i] = Instantiate(prefab_Keypoint, handInfo.root).transform;
  179. keyPoints[i].name = handInfo.handType.ToString() + "_" + jointNames[i];// "IndexFingerTip";
  180. if (!ShowHandJoint)
  181. {
  182. keyPoints[i].GetComponent<MeshRenderer>().enabled = false;
  183. }
  184. if (ShowHandJointAxis)
  185. {
  186. keyPoints_Axis[i] = Instantiate(prefab_Axis, handInfo.root).transform;
  187. }
  188. //食指尖
  189. if (i == 7)
  190. {
  191. keyPoints[i].GetComponent<BoxCollider>().size = new Vector3(0.2f, 0.2f, 0.2f);
  192. Rigidbody leftRigidbody = keyPoints[i].gameObject.AddComponent<Rigidbody>();
  193. leftRigidbody.useGravity = false;
  194. leftRigidbody.collisionDetectionMode = CollisionDetectionMode.Continuous;
  195. ////只要是Art/Standard的shader的物体在被这个脚本的物体靠近的时候会产生打光的效果
  196. //keyPoints_Left[i].gameObject.AddComponent<HoverLight>();
  197. }
  198. }
  199. //实例化骨骼
  200. for (int i = 0; i < jointNames.Length; i++)
  201. {
  202. if (i < 16)//小拇指之前的节点的关节实例化走这个逻辑
  203. {
  204. if ((i + 1) % 4 > 0 /*|| (i + 1) % 4 == 0*/)
  205. {
  206. Transform fingerBone = Instantiate(prefab_FingerBone, handInfo.root).transform;
  207. fingerBone.name = handInfo.handType.ToString() + "_" + i + "_" + i + 1;
  208. //fingerBone.SetUp(keyPoints_Left[i], keyPoints_Left[i + 1]);
  209. fingerBone.localScale = new Vector3(0.01f, 0.01f, (keyPoints[i].position - keyPoints[i + 1].position).magnitude);
  210. fingerBones.Add(i + 1, fingerBone.transform);
  211. if (!ShowHandJoint)
  212. {
  213. fingerBone.gameObject.SetActive(false);
  214. }
  215. }
  216. }
  217. else if (i < 20)//小拇指的5个节点的关节实例化走这个逻辑
  218. {
  219. Transform fingerBone = Instantiate(prefab_FingerBone, handInfo.root).transform;
  220. fingerBone.name = handInfo.handType.ToString() + "_" + i + "_" + i + 1;
  221. //fingerBone.SetUp(keyPoints_Left[i], keyPoints_Left[i + 1]);
  222. fingerBone.localScale = new Vector3(0.01f, 0.01f, (keyPoints[i].position - keyPoints[i + 1].position).magnitude);
  223. fingerBones.Add(i + 1, fingerBone.transform);
  224. if (!ShowHandJoint)
  225. {
  226. fingerBone.gameObject.SetActive(false);
  227. }
  228. }
  229. }
  230. #endregion
  231. #region 2D展示
  232. //canvasRoot_Left = GameObject.Find("TextureCanvas/LeftGrayCamera").transform;
  233. //canvasRoot_Right = GameObject.Find("TextureCanvas/RightGrayCamera").transform;
  234. ////实例化21个关节点的prefab
  235. //for (int i = 0; i < 21; i++)
  236. //{
  237. // //左鱼眼
  238. // keyPoints2D_LeftFish_LeftHand[i] = Instantiate(prefab_Keypoint2D, canvasRoot_Left).GetComponent<RectTransform>();
  239. // keyPoints2D_LeftFish_RightHand[i] = Instantiate(prefab_Keypoint2D, canvasRoot_Left).GetComponent<RectTransform>();
  240. // //右鱼眼
  241. // keyPoints2D_RightFish_LeftHand[i] = Instantiate(prefab_Keypoint2D, canvasRoot_Right).GetComponent<RectTransform>();
  242. // keyPoints2D_RightFish_RightHand[i] = Instantiate(prefab_Keypoint2D, canvasRoot_Right).GetComponent<RectTransform>();
  243. //}
  244. //for (int i = 0; i < 21; i++)
  245. //{
  246. // if ((i + 1) % 4 > 1 || (i + 1) % 4 == 0)
  247. // {
  248. // GameObject fingerBone = Instantiate(prefab_FingerBone2D, canvasRoot_Left).gameObject;
  249. // fingerBone.name = "L_L_" + (i - 1) + "_" + i;
  250. // fingerBones2D_LeftFish_LeftHand.Add(i, fingerBone.GetComponent<RectTransform>());
  251. // if (i < 4)
  252. // {
  253. // fingerBone.GetComponent<Image>().color = Color.blue;
  254. // }
  255. // else if (i < 8)
  256. // {
  257. // fingerBone.GetComponent<Image>().color = Color.red;
  258. // }
  259. // else if (i < 12)
  260. // {
  261. // fingerBone.GetComponent<Image>().color = Color.cyan;
  262. // }
  263. // else if (i < 16)
  264. // {
  265. // fingerBone.GetComponent<Image>().color = Color.yellow;
  266. // }
  267. // else if (i < 20)
  268. // {
  269. // fingerBone.GetComponent<Image>().color = Color.green;
  270. // }
  271. // fingerBone = Instantiate(prefab_FingerBone2D, canvasRoot_Right).gameObject;
  272. // fingerBone.name = "R_L_" + (i - 1) + "_" + i;
  273. // fingerBones2D_RightFish_LeftHand.Add(i, fingerBone.GetComponent<RectTransform>());
  274. // if (i < 4)
  275. // {
  276. // fingerBone.GetComponent<Image>().color = Color.blue;
  277. // }
  278. // else if (i < 8)
  279. // {
  280. // fingerBone.GetComponent<Image>().color = Color.red;
  281. // }
  282. // else if (i < 12)
  283. // {
  284. // fingerBone.GetComponent<Image>().color = Color.cyan;
  285. // }
  286. // else if (i < 16)
  287. // {
  288. // fingerBone.GetComponent<Image>().color = Color.yellow;
  289. // }
  290. // else if (i < 20)
  291. // {
  292. // fingerBone.GetComponent<Image>().color = Color.green;
  293. // }
  294. // fingerBone = Instantiate(prefab_FingerBone2D, canvasRoot_Left).gameObject;
  295. // fingerBone.name = "L_R_" + (i - 1) + "_" + i;
  296. // fingerBones2D_LeftFish_RightHand.Add(i, fingerBone.GetComponent<RectTransform>());
  297. // if (i < 4)
  298. // {
  299. // fingerBone.GetComponent<Image>().color = Color.blue;
  300. // }
  301. // else if (i < 8)
  302. // {
  303. // fingerBone.GetComponent<Image>().color = Color.red;
  304. // }
  305. // else if (i < 12)
  306. // {
  307. // fingerBone.GetComponent<Image>().color = Color.cyan;
  308. // }
  309. // else if (i < 16)
  310. // {
  311. // fingerBone.GetComponent<Image>().color = Color.yellow;
  312. // }
  313. // else if (i < 20)
  314. // {
  315. // fingerBone.GetComponent<Image>().color = Color.green;
  316. // }
  317. // fingerBone = Instantiate(prefab_FingerBone2D, canvasRoot_Right).gameObject;
  318. // fingerBone.name = "R_R_" + (i - 1) + "_" + i;
  319. // fingerBones2D_RightFish_RightHand.Add(i, fingerBone.GetComponent<RectTransform>());
  320. // if (i < 4)
  321. // {
  322. // fingerBone.GetComponent<Image>().color = Color.blue;
  323. // }
  324. // else if (i < 8)
  325. // {
  326. // fingerBone.GetComponent<Image>().color = Color.red;
  327. // }
  328. // else if (i < 12)
  329. // {
  330. // fingerBone.GetComponent<Image>().color = Color.cyan;
  331. // }
  332. // else if (i < 16)
  333. // {
  334. // fingerBone.GetComponent<Image>().color = Color.yellow;
  335. // }
  336. // else if (i < 20)
  337. // {
  338. // fingerBone.GetComponent<Image>().color = Color.green;
  339. // }
  340. // }
  341. //}
  342. #endregion
  343. UpdatePose();
  344. }
  345. void Update()
  346. {
  347. if (lastVisibility != visibility)
  348. {
  349. lastVisibility = visibility;
  350. Show(visibility);
  351. }
  352. }
  353. void LateUpdate()
  354. {
  355. UpdatePose();
  356. }
  357. void UpdatePose()
  358. {
  359. #region 3D展示
  360. if (handInfo.Exist)
  361. {
  362. //if (handLeft.handTrackingData.handJointData != null)
  363. {
  364. foreach (HandJointType key in handInfo.jointsPose.Keys)
  365. {
  366. int id = (int)key;
  367. //更新KeyPoint的Pose
  368. keyPoints[id].position = handInfo.GetJointData(key).position;
  369. keyPoints[id].rotation = handInfo.GetJointData(key).rotation;
  370. if (ShowHandJointAxis)
  371. {
  372. keyPoints_Axis[id].position = handInfo.GetJointData(key).position;
  373. keyPoints_Axis[id].rotation = handInfo.GetJointData(key).rotation;
  374. }
  375. //更新FingerBone的Pose
  376. if (id > 0)
  377. {
  378. if (fingerBones.ContainsKey(id))
  379. {
  380. fingerBones[id].transform.position = keyPoints[id].position;
  381. fingerBones[id].transform.localScale = new Vector3(0.01f, 0.01f, (keyPoints[id].position - keyPoints[id - 1].position).magnitude);
  382. fingerBones[id].transform.LookAt(keyPoints[id - 1]);
  383. }
  384. }
  385. }
  386. }
  387. }
  388. #endregion
  389. #region 2D展示
  390. //if (NativeSwapManager.iKData.hand1_valid)
  391. //{
  392. // if (NativeSwapManager.iKData.positions1_2d != null)
  393. // {
  394. // for (int i = 0; i < NativeSwapManager.iKData.positions1_2d.Length; i++)
  395. // {
  396. // keyPoints2D_LeftFish_LeftHand[i].anchoredPosition = new Vector2(NativeSwapManager.iKData.positions1_2d[i].x, -NativeSwapManager.iKData.positions1_2d[i].y);
  397. // keyPoints2D_RightFish_LeftHand[i].anchoredPosition = new Vector2(NativeSwapManager.iKData.positions3_2d[i].x, -NativeSwapManager.iKData.positions3_2d[i].y);
  398. // if (fingerBones2D_LeftFish_LeftHand.ContainsKey(i - 1))
  399. // {
  400. // fingerBones2D_LeftFish_LeftHand[i - 1].anchoredPosition = (keyPoints2D_LeftFish_LeftHand[i - 1].anchoredPosition + keyPoints2D_LeftFish_LeftHand[i].anchoredPosition) / 2.0f;
  401. // Vector2 temp0 = keyPoints2D_LeftFish_LeftHand[i - 1].anchoredPosition - keyPoints2D_LeftFish_LeftHand[i].anchoredPosition;
  402. // fingerBones2D_LeftFish_LeftHand[i - 1].localRotation = Quaternion.FromToRotation(Vector2.up, temp0);
  403. // fingerBones2D_LeftFish_LeftHand[i - 1].localScale = new Vector3(1, temp0.magnitude / fingerBones2D_LeftFish_LeftHand[i - 1].sizeDelta.y, 1);
  404. // fingerBones2D_RightFish_LeftHand[i - 1].anchoredPosition = (keyPoints2D_RightFish_LeftHand[i - 1].anchoredPosition + keyPoints2D_RightFish_LeftHand[i].anchoredPosition) / 2.0f;
  405. // temp0 = keyPoints2D_RightFish_LeftHand[i - 1].anchoredPosition - keyPoints2D_RightFish_LeftHand[i].anchoredPosition;
  406. // fingerBones2D_RightFish_LeftHand[i - 1].localRotation = Quaternion.FromToRotation(Vector2.up, temp0);
  407. // fingerBones2D_RightFish_LeftHand[i - 1].localScale = new Vector3(1, temp0.magnitude / fingerBones2D_RightFish_LeftHand[i - 1].sizeDelta.y, 1);
  408. // }
  409. // }
  410. // }
  411. //}
  412. //else
  413. //{
  414. // if (NativeSwapManager.iKData.positions1_2d != null)
  415. // {
  416. // for (int i = 0; i < NativeSwapManager.iKData.positions1_2d.Length; i++)
  417. // {
  418. // keyPoints2D_LeftFish_LeftHand[i].anchoredPosition = new Vector2(9999, 9999);
  419. // keyPoints2D_RightFish_LeftHand[i].anchoredPosition = new Vector2(9999, 9999);
  420. // if (fingerBones2D_LeftFish_LeftHand.ContainsKey(i - 1))
  421. // {
  422. // fingerBones2D_LeftFish_LeftHand[i - 1].anchoredPosition = new Vector2(9999, 9999);
  423. // fingerBones2D_RightFish_LeftHand[i - 1].anchoredPosition = new Vector2(9999, 9999);
  424. // }
  425. // }
  426. // }
  427. //}
  428. //if (NativeSwapManager.iKData.hand2_valid)
  429. //{
  430. // if (NativeSwapManager.iKData.positions2_2d != null)
  431. // {
  432. // for (int i = 0; i < NativeSwapManager.iKData.positions2_2d.Length; i++)
  433. // {
  434. // keyPoints2D_LeftFish_RightHand[i].anchoredPosition = new Vector2(NativeSwapManager.iKData.positions2_2d[i].x, -NativeSwapManager.iKData.positions2_2d[i].y);
  435. // keyPoints2D_RightFish_RightHand[i].anchoredPosition = new Vector2(NativeSwapManager.iKData.positions4_2d[i].x, -NativeSwapManager.iKData.positions4_2d[i].y);
  436. // if (fingerBones2D_LeftFish_RightHand.ContainsKey(i - 1))
  437. // {
  438. // fingerBones2D_LeftFish_RightHand[i - 1].anchoredPosition = (keyPoints2D_LeftFish_RightHand[i - 1].anchoredPosition + keyPoints2D_LeftFish_RightHand[i].anchoredPosition) / 2.0f;
  439. // Vector2 temp0 = keyPoints2D_LeftFish_RightHand[i - 1].anchoredPosition - keyPoints2D_LeftFish_RightHand[i].anchoredPosition;
  440. // fingerBones2D_LeftFish_RightHand[i - 1].localRotation = Quaternion.FromToRotation(Vector2.up, temp0);
  441. // fingerBones2D_LeftFish_RightHand[i - 1].localScale = new Vector3(1, temp0.magnitude / fingerBones2D_LeftFish_RightHand[i - 1].sizeDelta.y, 1);
  442. // fingerBones2D_RightFish_RightHand[i - 1].anchoredPosition = (keyPoints2D_RightFish_RightHand[i - 1].anchoredPosition + keyPoints2D_RightFish_RightHand[i].anchoredPosition) / 2.0f;
  443. // temp0 = keyPoints2D_RightFish_RightHand[i - 1].anchoredPosition - keyPoints2D_RightFish_RightHand[i].anchoredPosition;
  444. // fingerBones2D_RightFish_RightHand[i - 1].localRotation = Quaternion.FromToRotation(Vector2.up, temp0);
  445. // fingerBones2D_RightFish_RightHand[i - 1].localScale = new Vector3(1, temp0.magnitude / fingerBones2D_RightFish_RightHand[i - 1].sizeDelta.y, 1);
  446. // }
  447. // }
  448. // }
  449. //}
  450. //else
  451. //{
  452. // if (NativeSwapManager.iKData.positions2_2d != null)
  453. // {
  454. // for (int i = 0; i < NativeSwapManager.iKData.positions2_2d.Length; i++)
  455. // {
  456. // keyPoints2D_LeftFish_RightHand[i].anchoredPosition = new Vector2(9999, 9999);
  457. // keyPoints2D_RightFish_RightHand[i].anchoredPosition = new Vector2(9999, 9999);
  458. // if (fingerBones2D_LeftFish_LeftHand.ContainsKey(i - 1))
  459. // {
  460. // fingerBones2D_LeftFish_RightHand[i - 1].anchoredPosition = new Vector2(9999, 9999);
  461. // fingerBones2D_RightFish_RightHand[i - 1].anchoredPosition = new Vector2(9999, 9999);
  462. // }
  463. // }
  464. // }
  465. //}
  466. #endregion
  467. }
  468. }
  469. }