Kinect.AvatarController.ResetToInitialPosition C# (CSharp) Method

ResetToInitialPosition() public method

public ResetToInitialPosition ( ) : void
return void
        public void ResetToInitialPosition()
        {
            playerId = 0;

            if (bones == null)
                return;

            // For each bone that was defined, reset to initial position.
            transform.rotation = Quaternion.identity;

            for (int pass = 0; pass < 2; pass++)  // 2 passes because clavicles are at the end
            {
                for (int i = 0; i < bones.Length; i++)
                {
                    if (bones[i] != null)
                    {
                        bones[i].rotation = initialRotations[i];
                    }
                }
            }

            //		if(bodyRoot != null)
            //		{
            //			bodyRoot.localPosition = Vector3.zero;
            //			bodyRoot.localRotation = Quaternion.identity;
            //		}

            // Restore the offset's position and rotation
            if (offsetNode != null)
            {
                offsetNode.transform.position = offsetNodePos;
                offsetNode.transform.rotation = offsetNodeRot;
            }

            transform.position = initialPosition;
            transform.rotation = initialRotation;
        }