Esempio n. 1
0
    private void UpdateHandPositions()
    {
        Vector3 leftHand, rightHand;

        if (niteController.GetJointPosition(NiteWrapper.SkeletonJoint.LEFT_HAND, out leftHand))
        {
            handPositions.left = leftHand;
        }
        if (niteController.GetJointPosition(NiteWrapper.SkeletonJoint.RIGHT_HAND, out rightHand))
        {
            handPositions.right = rightHand;
        }
    }
Esempio n. 2
0
    public void ToggleClothing(string clothingLabel)
    {
        Vector3 location;

        niteController.GetJointPosition(NiteWrapper.SkeletonJoint.TORSO_CENTER, out location);
        Debug.Log("Toggling " + clothingLabel);

        GameObject clothing = FindActiveClothing(clothingLabel);

        if (clothing == null)
        {
            clothing      = Object.Instantiate(Resources.Load(clothingLabel), location, Quaternion.identity) as GameObject;
            clothing.name = clothingLabel;
            if (niteController.RegisterRig(clothing))
            {
                //Add clothing to list of worn clothing
                addedClothing.Add(clothing);
            }
            else
            {
                Object.Destroy(clothing);
                Debug.LogWarning("Clothing rig not valid: " + clothingLabel);
            }
        }
        else
        {
            addedClothing.Remove(clothing);
            Object.Destroy(clothing);
        }
        //Debug.LogError("pause");
    }
Esempio n. 3
0
//  Not needed, turns out kinect skeleton always puts torso_center in line between hips and shoulders
//	public bool GetLowerTorsoTransformation(NiteController niteController,
//	                                       out Quaternion rotation, out Vector3 position) {
//		Vector3 positionLeftHip, positionRightHip, positionCenter;
//		bool succes = true;
//
//		if (!niteController.GetJointPosition(NiteWrapper.SkeletonJoint.LEFT_HIP, out positionLeftHip)) {
//			succes = false;
//		}
//		if (!niteController.GetJointPosition(NiteWrapper.SkeletonJoint.RIGHT_HIP, out positionRightHip)) {
//			succes = false;
//		}
//		if (!niteController.GetJointPosition(NiteWrapper.SkeletonJoint.TORSO_CENTER, out positionCenter)) {
//			succes = false;
//		}
//
//		if (succes) {
//			position = positionRightHip + (0.5F * (positionLeftHip - positionRightHip));
//			Vector3 forward = positionCenter - position;
//			Vector3 upward = position - positionRightHip;
//			rotation = Quaternion.LookRotation(forward, upward);
//			rotation.eulerAngles = rotation.eulerAngles + new Vector3(0,0,90);
//		}
//		else {
//			position = Vector3.zero;
//			rotation = Quaternion.identity;
//		}
//
//		return succes;
//	}

    public void UpdateBody(NiteController niteController)
    {
        if (!pauseUpdate && niteController.calibratedUser)
        {
            Vector3    position;
            Quaternion rotation;

            int size = skeletonJointMapping.Count;
            // Update the rotation for each joint
            foreach (KeyValuePair <NiteWrapper.SkeletonJoint, BodyJoint> pair in skeletonJointMapping)
            {
                if (niteController.GetJointOrientation(pair.Key, out rotation))
                {
                    pair.Value.transform.rotation = rotation;
                }
            }
//
//			// Update joint positions
//			foreach (KeyValuePair<NiteWrapper.SkeletonJoint, BodyJoint> pair in skeletonJointMapping) {
//				if (niteController.GetJointPosition(pair.Key, out position)) {
//				    pair.Value.transform.position = position;
//				}
//			}
//
            // Update body location
            if (niteController.GetJointPosition(NiteWrapper.SkeletonJoint.TORSO_CENTER, out position))
            {
                location = position;
                torsoCenter.transform.position = position;
            }
        }

        // Update hand positions, done seperately to make GUI work even if skeleton is wrong
        Vector3 leftHand, rightHand;

        if (niteController.GetJointPosition(NiteWrapper.SkeletonJoint.LEFT_HAND, out leftHand))
        {
            handPositions.left = leftHand;
        }
        if (niteController.GetJointPosition(NiteWrapper.SkeletonJoint.RIGHT_HAND, out rightHand))
        {
            handPositions.right = rightHand;
        }
    }
Esempio n. 4
0
//  Not needed, turns out kinect skeleton always puts torso_center in line between hips and shoulders
//	public bool GetLowerTorsoTransformation(NiteController niteController, 
//	                                       out Quaternion rotation, out Vector3 position) {
//		Vector3 positionLeftHip, positionRightHip, positionCenter;
//		bool succes = true;
//		
//		if (!niteController.GetJointPosition(NiteWrapper.SkeletonJoint.LEFT_HIP, out positionLeftHip)) {
//			succes = false;
//		}
//		if (!niteController.GetJointPosition(NiteWrapper.SkeletonJoint.RIGHT_HIP, out positionRightHip)) {
//			succes = false;
//		}
//		if (!niteController.GetJointPosition(NiteWrapper.SkeletonJoint.TORSO_CENTER, out positionCenter)) {
//			succes = false;
//		}
//		
//		if (succes) {
//			position = positionRightHip + (0.5F * (positionLeftHip - positionRightHip));
//			Vector3 forward = positionCenter - position;
//			Vector3 upward = position - positionRightHip;
//			rotation = Quaternion.LookRotation(forward, upward);
//			rotation.eulerAngles = rotation.eulerAngles + new Vector3(0,0,90);
//		}
//		else {
//			position = Vector3.zero;
//			rotation = Quaternion.identity;
//		}
//		
//		return succes;
//	}
	
	public void UpdateBody(NiteController niteController) {
		if (!pauseUpdate && niteController.calibratedUser) {
			Vector3 position;
			Quaternion rotation;
			
			int size = skeletonJointMapping.Count;
			// Update the rotation for each joint
			foreach (KeyValuePair<NiteWrapper.SkeletonJoint, BodyJoint> pair in skeletonJointMapping) {
				if (niteController.GetJointOrientation(pair.Key, out rotation)) {
				    pair.Value.transform.rotation = rotation;
				}
			}
//			
//			// Update joint positions
//			foreach (KeyValuePair<NiteWrapper.SkeletonJoint, BodyJoint> pair in skeletonJointMapping) {
//				if (niteController.GetJointPosition(pair.Key, out position)) {
//				    pair.Value.transform.position = position;
//				}
//			}
//			
			// Update body location
			if (niteController.GetJointPosition(NiteWrapper.SkeletonJoint.TORSO_CENTER, out position)) {
				location = position;
				torsoCenter.transform.position = position;
			}
		}
		
		// Update hand positions, done seperately to make GUI work even if skeleton is wrong
		Vector3 leftHand, rightHand;
		if (niteController.GetJointPosition(NiteWrapper.SkeletonJoint.LEFT_HAND, out leftHand)) {
			handPositions.left = leftHand;
		}
		if (niteController.GetJointPosition(NiteWrapper.SkeletonJoint.RIGHT_HAND, out rightHand)) {
			handPositions.right = rightHand;
		}
	}
Esempio n. 5
0
	public void InitBody(NiteController niteController) {
		Debug.Log("Initializing the user body");
		niteController.Update(); // NiteWrapper does not have the new transforms yet
		
		// TODO: get radius
		float upperLegRadius = 0.075F, lowerLegRadius = 0.06F, neckRadius = 0.05F;

		//get positions of left arm parts
		Vector3 leftShoulderPos, leftElbowPos, leftHandPos;
		Quaternion leftShoulderRot, leftElbowRot;
		niteController.GetJointPosition(NiteWrapper.SkeletonJoint.LEFT_SHOULDER, out leftShoulderPos);
		niteController.GetJointPosition(NiteWrapper.SkeletonJoint.LEFT_ELBOW, out leftElbowPos);
		niteController.GetJointPosition(NiteWrapper.SkeletonJoint.LEFT_HAND, out leftHandPos);
		niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.LEFT_SHOULDER, out leftShoulderRot);
		niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.LEFT_ELBOW, out leftElbowRot);
		
		//intialize left arm components
		float leftArmUpperRadius = 0.5F * niteController.diameter[(int)NiteWrapper.BodySlice.LEFT_ARM_UPPER_2];
		float leftArmLowerRadius = 0.5F * niteController.diameter[(int)NiteWrapper.BodySlice.LEFT_ARM_LOWER_2];
		if (leftArmUpperRadius > 0.07F){
			leftArmUpperRadius = 0.07F;
		}
		if (leftArmLowerRadius > 0.06F){
			leftArmLowerRadius = 0.06F;
		}
		leftShoulder = new BodyJoint("Left_Shoulder", leftShoulderPos, leftShoulderRot, Vector3.left, (leftElbowPos - leftShoulderPos).magnitude, leftArmUpperRadius);
		leftElbow = new BodyJoint("Left_Elbow", leftElbowPos, leftElbowRot, Vector3.left, (leftHandPos - leftElbowPos).magnitude, leftArmLowerRadius);
		leftElbow.transform.parent = leftShoulder.transform;
		
		//get positions of right arm parts
		Vector3 rightShoulderPos, rightElbowPos, rightHandPos;
		Quaternion rightShoulderRot, rightElbowRot;
		niteController.GetJointPosition(NiteWrapper.SkeletonJoint.RIGHT_SHOULDER, out rightShoulderPos);
		niteController.GetJointPosition(NiteWrapper.SkeletonJoint.RIGHT_ELBOW, out rightElbowPos);
		niteController.GetJointPosition(NiteWrapper.SkeletonJoint.RIGHT_HAND, out rightHandPos);
		niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.RIGHT_SHOULDER, out rightShoulderRot);
		niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.RIGHT_ELBOW, out rightElbowRot);
		
		//intialize right arm components
		float rightArmUpperRadius = 0.5F * niteController.diameter[(int)NiteWrapper.BodySlice.RIGHT_ARM_UPPER_2];
		float rightArmLowerRadius = 0.5F * niteController.diameter[(int)NiteWrapper.BodySlice.RIGHT_ARM_LOWER_2];
		if (rightArmUpperRadius > 0.07F){
			rightArmUpperRadius = 0.07F;
		}
		if (rightArmLowerRadius > 0.06F){
			rightArmLowerRadius = 0.06F;
		}		
		rightShoulder = new BodyJoint("Right_Shoulder", rightShoulderPos, rightShoulderRot, Vector3.right, (rightElbowPos - rightShoulderPos).magnitude, rightArmUpperRadius);
		rightElbow = new BodyJoint("Right_Elbow", rightElbowPos, rightElbowRot, Vector3.right, (rightHandPos - rightElbowPos).magnitude, rightArmLowerRadius);
		rightElbow.transform.parent = rightShoulder.transform;

		//get positions of left leg parts
		Vector3 leftHipPos, leftKneePos, leftFootPos;
		Quaternion leftHipRot, leftKneeRot;
		niteController.GetJointPosition(NiteWrapper.SkeletonJoint.LEFT_HIP, out leftHipPos);
		niteController.GetJointPosition(NiteWrapper.SkeletonJoint.LEFT_KNEE, out leftKneePos);
		niteController.GetJointPosition(NiteWrapper.SkeletonJoint.LEFT_FOOT, out leftFootPos);
		niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.LEFT_HIP, out leftHipRot);
		niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.LEFT_KNEE, out leftKneeRot);
		
		//intialize left leg components
		leftHip = new BodyJoint("Left_Hip", leftHipPos, leftHipRot, Vector3.down, (leftKneePos - leftHipPos).magnitude, upperLegRadius);
		leftKnee = new BodyJoint("Left_Knee", leftKneePos, leftKneeRot, Vector3.down, (leftFootPos - leftKneePos).magnitude, lowerLegRadius);
		leftKnee.transform.parent = leftHip.transform;
		
		//get positions of right leg parts
		Vector3 rightHipPos, rightKneePos, rightFootPos;
		Quaternion rightHipRot, rightKneeRot;
		niteController.GetJointPosition(NiteWrapper.SkeletonJoint.RIGHT_HIP, out rightHipPos);
		niteController.GetJointPosition(NiteWrapper.SkeletonJoint.RIGHT_KNEE, out rightKneePos);
		niteController.GetJointPosition(NiteWrapper.SkeletonJoint.RIGHT_FOOT, out rightFootPos);
		niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.RIGHT_HIP, out rightHipRot);
		niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.RIGHT_KNEE, out rightKneeRot);
		
		//intialize right leg components
		rightHip = new BodyJoint("Right_Hip", rightHipPos, rightHipRot, Vector3.down, (rightKneePos - rightHipPos).magnitude, upperLegRadius);
		rightKnee = new BodyJoint("Right_Knee", rightKneePos, rightKneeRot, Vector3.down, (rightFootPos - rightKneePos).magnitude, lowerLegRadius);
		rightKnee.transform.parent = rightHip.transform;
		
		//get positions of neck and head
		Vector3 neckPos, headPos;
		Quaternion neckRot;
		niteController.GetJointPosition(NiteWrapper.SkeletonJoint.NECK, out neckPos);
		niteController.GetJointPosition(NiteWrapper.SkeletonJoint.HEAD, out headPos);
		niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.NECK, out neckRot);
		
		//initialize neck joint
		neck = new BodyJoint("Neck", neckPos, neckRot, Vector3.up, (headPos - neckPos).magnitude, neckRadius); 
		
		//get positions of torso
		Vector3 torsoPos;
		Quaternion torsoRot;
		niteController.GetJointPosition(NiteWrapper.SkeletonJoint.TORSO_CENTER, out torsoPos);
		niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.TORSO_CENTER, out torsoRot);
		
		//initialize torso
		float shoulderRadius = (0.5F * niteController.diameter[(int)NiteWrapper.BodySlice.LEFT_ARM_UPPER_1] +
			0.5F * niteController.diameter[(int)NiteWrapper.BodySlice.RIGHT_ARM_UPPER_1]) / 2.0F;
		float upperLength, lowerLength;
		upperLength = (neckPos - torsoPos).magnitude;
		lowerLength = (leftHipPos + 0.5F * (rightHipPos - leftHipPos) - torsoPos).magnitude; //from centerpoint between the two hips to torso_center
		AdaptableTorso torso = new AdaptableTorso(torsoPos, torsoRot, upperLength, lowerLength, shoulderRadius);
		torso.AdaptToUser(niteController);
		torsoCenter = (BodyJoint)torso;
		neck.transform.parent = torsoCenter.transform;
		leftShoulder.transform.parent = torsoCenter.transform;
		rightShoulder.transform.parent = torsoCenter.transform;
		leftHip.transform.parent = torsoCenter.transform;
		rightHip.transform.parent = torsoCenter.transform;
			
		skeletonJointMapping = new Dictionary<NiteWrapper.SkeletonJoint, BodyJoint>();
//		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.HEAD, new BodyJoint());
		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.NECK, neck);
		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.LEFT_SHOULDER, leftShoulder);
		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.LEFT_ELBOW, leftElbow);
//		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.LEFT_HAND, new BodyJoint());
		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.RIGHT_SHOULDER, rightShoulder);
		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.RIGHT_ELBOW, rightElbow);
//		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.RIGHT_HAND, new BodyJoint());
		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.TORSO_CENTER, torsoCenter);
		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.LEFT_HIP, leftHip);
		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.LEFT_KNEE, leftKnee);
//		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.LEFT_FOOT, new BodyJoint());
		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.RIGHT_HIP, rightHip);
		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.RIGHT_KNEE, rightKnee);
		size = skeletonJointMapping.Count;
//		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.RIGHT_FOOT, new BodyJoint());
	}
Esempio n. 6
0
    public void InitBody(NiteController niteController)
    {
        Debug.Log("Initializing the user body");
        niteController.Update();         // NiteWrapper does not have the new transforms yet

        // TODO: get radius
        float upperLegRadius = 0.075F, lowerLegRadius = 0.06F, neckRadius = 0.05F;

        //get positions of left arm parts
        Vector3    leftShoulderPos, leftElbowPos, leftHandPos;
        Quaternion leftShoulderRot, leftElbowRot;

        niteController.GetJointPosition(NiteWrapper.SkeletonJoint.LEFT_SHOULDER, out leftShoulderPos);
        niteController.GetJointPosition(NiteWrapper.SkeletonJoint.LEFT_ELBOW, out leftElbowPos);
        niteController.GetJointPosition(NiteWrapper.SkeletonJoint.LEFT_HAND, out leftHandPos);
        niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.LEFT_SHOULDER, out leftShoulderRot);
        niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.LEFT_ELBOW, out leftElbowRot);

        //intialize left arm components
        float leftArmUpperRadius = 0.5F * niteController.diameter[(int)NiteWrapper.BodySlice.LEFT_ARM_UPPER_2];
        float leftArmLowerRadius = 0.5F * niteController.diameter[(int)NiteWrapper.BodySlice.LEFT_ARM_LOWER_2];

        if (leftArmUpperRadius > 0.07F)
        {
            leftArmUpperRadius = 0.07F;
        }
        if (leftArmLowerRadius > 0.06F)
        {
            leftArmLowerRadius = 0.06F;
        }
        leftShoulder = new BodyJoint("Left_Shoulder", leftShoulderPos, leftShoulderRot, Vector3.left, (leftElbowPos - leftShoulderPos).magnitude, leftArmUpperRadius);
        leftElbow    = new BodyJoint("Left_Elbow", leftElbowPos, leftElbowRot, Vector3.left, (leftHandPos - leftElbowPos).magnitude, leftArmLowerRadius);
        leftElbow.transform.parent = leftShoulder.transform;

        //get positions of right arm parts
        Vector3    rightShoulderPos, rightElbowPos, rightHandPos;
        Quaternion rightShoulderRot, rightElbowRot;

        niteController.GetJointPosition(NiteWrapper.SkeletonJoint.RIGHT_SHOULDER, out rightShoulderPos);
        niteController.GetJointPosition(NiteWrapper.SkeletonJoint.RIGHT_ELBOW, out rightElbowPos);
        niteController.GetJointPosition(NiteWrapper.SkeletonJoint.RIGHT_HAND, out rightHandPos);
        niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.RIGHT_SHOULDER, out rightShoulderRot);
        niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.RIGHT_ELBOW, out rightElbowRot);

        //intialize right arm components
        float rightArmUpperRadius = 0.5F * niteController.diameter[(int)NiteWrapper.BodySlice.RIGHT_ARM_UPPER_2];
        float rightArmLowerRadius = 0.5F * niteController.diameter[(int)NiteWrapper.BodySlice.RIGHT_ARM_LOWER_2];

        if (rightArmUpperRadius > 0.07F)
        {
            rightArmUpperRadius = 0.07F;
        }
        if (rightArmLowerRadius > 0.06F)
        {
            rightArmLowerRadius = 0.06F;
        }
        rightShoulder = new BodyJoint("Right_Shoulder", rightShoulderPos, rightShoulderRot, Vector3.right, (rightElbowPos - rightShoulderPos).magnitude, rightArmUpperRadius);
        rightElbow    = new BodyJoint("Right_Elbow", rightElbowPos, rightElbowRot, Vector3.right, (rightHandPos - rightElbowPos).magnitude, rightArmLowerRadius);
        rightElbow.transform.parent = rightShoulder.transform;

        //get positions of left leg parts
        Vector3    leftHipPos, leftKneePos, leftFootPos;
        Quaternion leftHipRot, leftKneeRot;

        niteController.GetJointPosition(NiteWrapper.SkeletonJoint.LEFT_HIP, out leftHipPos);
        niteController.GetJointPosition(NiteWrapper.SkeletonJoint.LEFT_KNEE, out leftKneePos);
        niteController.GetJointPosition(NiteWrapper.SkeletonJoint.LEFT_FOOT, out leftFootPos);
        niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.LEFT_HIP, out leftHipRot);
        niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.LEFT_KNEE, out leftKneeRot);

        //intialize left leg components
        leftHip  = new BodyJoint("Left_Hip", leftHipPos, leftHipRot, Vector3.down, (leftKneePos - leftHipPos).magnitude, upperLegRadius);
        leftKnee = new BodyJoint("Left_Knee", leftKneePos, leftKneeRot, Vector3.down, (leftFootPos - leftKneePos).magnitude, lowerLegRadius);
        leftKnee.transform.parent = leftHip.transform;

        //get positions of right leg parts
        Vector3    rightHipPos, rightKneePos, rightFootPos;
        Quaternion rightHipRot, rightKneeRot;

        niteController.GetJointPosition(NiteWrapper.SkeletonJoint.RIGHT_HIP, out rightHipPos);
        niteController.GetJointPosition(NiteWrapper.SkeletonJoint.RIGHT_KNEE, out rightKneePos);
        niteController.GetJointPosition(NiteWrapper.SkeletonJoint.RIGHT_FOOT, out rightFootPos);
        niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.RIGHT_HIP, out rightHipRot);
        niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.RIGHT_KNEE, out rightKneeRot);

        //intialize right leg components
        rightHip  = new BodyJoint("Right_Hip", rightHipPos, rightHipRot, Vector3.down, (rightKneePos - rightHipPos).magnitude, upperLegRadius);
        rightKnee = new BodyJoint("Right_Knee", rightKneePos, rightKneeRot, Vector3.down, (rightFootPos - rightKneePos).magnitude, lowerLegRadius);
        rightKnee.transform.parent = rightHip.transform;

        //get positions of neck and head
        Vector3    neckPos, headPos;
        Quaternion neckRot;

        niteController.GetJointPosition(NiteWrapper.SkeletonJoint.NECK, out neckPos);
        niteController.GetJointPosition(NiteWrapper.SkeletonJoint.HEAD, out headPos);
        niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.NECK, out neckRot);

        //initialize neck joint
        neck = new BodyJoint("Neck", neckPos, neckRot, Vector3.up, (headPos - neckPos).magnitude, neckRadius);

        //get positions of torso
        Vector3    torsoPos;
        Quaternion torsoRot;

        niteController.GetJointPosition(NiteWrapper.SkeletonJoint.TORSO_CENTER, out torsoPos);
        niteController.GetJointOrientation(NiteWrapper.SkeletonJoint.TORSO_CENTER, out torsoRot);

        //initialize torso
        float shoulderRadius = (0.5F * niteController.diameter[(int)NiteWrapper.BodySlice.LEFT_ARM_UPPER_1] +
                                0.5F * niteController.diameter[(int)NiteWrapper.BodySlice.RIGHT_ARM_UPPER_1]) / 2.0F;
        float upperLength, lowerLength;

        upperLength = (neckPos - torsoPos).magnitude;
        lowerLength = (leftHipPos + 0.5F * (rightHipPos - leftHipPos) - torsoPos).magnitude;         //from centerpoint between the two hips to torso_center
        AdaptableTorso torso = new AdaptableTorso(torsoPos, torsoRot, upperLength, lowerLength, shoulderRadius);

        torso.AdaptToUser(niteController);
        torsoCenter                    = (BodyJoint)torso;
        neck.transform.parent          = torsoCenter.transform;
        leftShoulder.transform.parent  = torsoCenter.transform;
        rightShoulder.transform.parent = torsoCenter.transform;
        leftHip.transform.parent       = torsoCenter.transform;
        rightHip.transform.parent      = torsoCenter.transform;

        skeletonJointMapping = new Dictionary <NiteWrapper.SkeletonJoint, BodyJoint>();
//		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.HEAD, new BodyJoint());
        skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.NECK, neck);
        skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.LEFT_SHOULDER, leftShoulder);
        skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.LEFT_ELBOW, leftElbow);
//		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.LEFT_HAND, new BodyJoint());
        skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.RIGHT_SHOULDER, rightShoulder);
        skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.RIGHT_ELBOW, rightElbow);
//		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.RIGHT_HAND, new BodyJoint());
        skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.TORSO_CENTER, torsoCenter);
        skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.LEFT_HIP, leftHip);
        skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.LEFT_KNEE, leftKnee);
//		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.LEFT_FOOT, new BodyJoint());
        skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.RIGHT_HIP, rightHip);
        skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.RIGHT_KNEE, rightKnee);
        size = skeletonJointMapping.Count;
//		skeletonJointMapping.Add(NiteWrapper.SkeletonJoint.RIGHT_FOOT, new BodyJoint());
    }