void Start() { handGestures = GameObject.FindGameObjectWithTag("Gestures").GetComponent <HandGestures>(); player = GameObject.FindGameObjectWithTag("Player"); vp = player.GetComponent <VolleyballPlayer>(); HandGestures.OnGestureChanged += CheckRemoveSetGesture; }
private void WriteToFile(float[,] foto, HandGestures gest) { using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\Public\gesture\images15.txt", true)) { for (int i = 0; i < 30; i++) { for (int j = 0; j < 30; j++) { file.Write(foto[i, j] + " "); } } file.WriteLine(); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\Public\gesture\labels15.txt", true)) { file.Write((int)gest); file.WriteLine(); } }
void Update () { if(handGestures == null) handGestures = GameObject.Find("Manager").GetComponent<HandGestures>(); RaycastHit hit; if (this.gameObject.name == "Bip01 R Finger12")//Right hand { Vector3 fwdr = transform.TransformDirection(Vector3.left); Vector3 forward = transform.TransformDirection(Vector3.left) * 100; Debug.DrawRay(transform.position, forward, Color.green); //if (Physics.Raycast(transform.position, fwdr, out hit, 100, lm)) //RenderVolume(transform.position, forward, 0.1f, transform.forward, 100); if (Physics.SphereCast(transform.position, 0.1f, fwdr, out hit, 100, lm)) { //Debug.Log("hitting with right Rc"); handGestures.curPointingGo = hit.transform.gameObject; } } else if (this.gameObject.name == "Bip01 R Finger048")//Left hand { Vector3 fwdl = transform.TransformDirection(Vector3.right); Vector3 forward = transform.TransformDirection(Vector3.right) * 100; Debug.DrawRay(transform.position, forward, Color.red); //if (Physics.Raycast(transform.position, fwdl, out hit, 100, lm)) //RenderVolume(transform.position, forward, 0.1f, transform.forward, 100); if (Physics.SphereCast(transform.position, 0.1f, fwdl, out hit, 100, lm)) { //Debug.Log("hitting with left Rc"); handGestures.curPointingGo = hit.transform.gameObject; } } else { handGestures.curPointingGo = null; //handGestures.pointingLGo = null; } }
public void StartRecording(int number, HandGestures hg) { status = hg; actual = number; }