void Start() { ParentGloveBehavior = GetComponentInParent <MaestroGloveBehaviour>(); }
// Start is called before the first frame update void Start() { if (instance == null) { instance = this; } leftHistory = new List <Vector3>(); rightHistory = new List <Vector3>(); watcher.gameObject.SetActive(false); left.gameObject.SetActive(false); right.gameObject.SetActive(false); process.gameObject.SetActive(false); leftConnected.gameObject.SetActive(false); rightConnected.gameObject.SetActive(false); // Find active left/right hands MaestroHand[] hands = GameObject.FindObjectsOfType <MaestroHand>(); foreach (MaestroHand hand in hands) { if (hand.whichHand == WhichHand.LeftHand) { if (leftHand == null) { leftHand = hand; } else { continue; } } else { if (rightHand == null) { rightHand = hand; } else { continue; } } } // Get gloves rightGlove = rightHand.gameObject.GetComponentInParent <MaestroGloveBehaviour>(); leftGlove = leftHand.gameObject.GetComponentInParent <MaestroGloveBehaviour>(); // Find main camera mainCamera = GameObject.FindObjectOfType <Camera>(); if (mainCamera == null) { Debug.LogError("Main Camera not found!"); } // Spawn panels leftPanel = Instantiate(panelPrefab); rightPanel = Instantiate(panelPrefab); // Get Text meshes leftText = leftPanel.GetComponentInChildren <TextMesh>(); leftText.text = "Please wait...\r\nLeft Connecting"; rightText = rightPanel.GetComponentInChildren <TextMesh>(); // Init history RecordHistory(); // Init panel positions OrientPanel(leftPanel, getAverage(leftHistory)); OrientPanel(rightPanel, getAverage(rightHistory)); }