// Update is called once per frame void Update() { if (GameObject.Find("KinectTAdapter").GetComponent <KinectTwoAdapter>().currentBody != null) { if (FullBodyObject == null) { return; } _FullBodyObject = FullBodyObject.GetComponent <FullBody>(); if (_FullBodyObject == null) { return; } BodyPointPosition pos = _FullBodyObject.ReturnPointPosition((BodyParts)Enum.Parse(typeof(BodyParts), gameObject.transform.name.ToString())); Vector3 B = new Vector3(pos.x, pos.y, pos.z); Vector3 C = B.normalized * StartPosition.magnitude; Debug.Log("magnitud b " + StartPosition.magnitude + " magnitude c " + C.magnitude); //float factor = B.magnitude / StartPosition.magnitude; //B.Scale(new Vector3(factor, factor, factor)); transform.position = C; //StartPosition = v; //Debug.Log("Elbow: x:"+pos.x + ", " + pos.y + "" + pos.z); } }
// setup the game void Start() { // set the current time to the startTime specified currentTime = startTime; // get a reference to the GameManager component for use by other scripts if (gms == null) { gms = this.gameObject.GetComponent <GameManagerSushi>(); } // init scoreboard to 0 mainScoreDisplay.text = ""; if (countdownDisplayObject) { countdownDisplay = countdownDisplayObject.GetComponent <Text>(); } spawner = GameObject.Find("Spawner").GetComponent <MovementDetectionLibrary.SpawnGameObjects>(); if (FullBodyObject) { fBodyObject = FullBodyObject.GetComponent <MovementDetectionLibrary.FullBody>(); } //Initialize angle values bestPartialLeftShoulderAngle = 0.0f; bestTotalLeftShoulderAngle = 0.0f; bestPartialRightShoulderAngle = 0.0f; bestTotalRightShoulderAngle = 0.0f; //Initialize time values for final animation animEnded = false; }