private bool GetUserBodyHeight(KinectManager manager, float scaleFactor, ref float height)
{
height = 0f;
if (manager && manager.IsJointTracked(currentUserId, (int)KinectInterop.JointType.HipLeft) &&
manager.IsJointTracked(currentUserId, (int)KinectInterop.JointType.HipRight) &&
manager.IsJointTracked(currentUserId, (int)KinectInterop.JointType.ShoulderLeft) &&
manager.IsJointTracked(currentUserId, (int)KinectInterop.JointType.ShoulderRight))
{
//Vector3 posHipCenter = manager.GetJointPosition(currentUserId, (int)KinectInterop.JointType.SpineBase);
Vector3 posHipLeft = manager.GetJointPosition(currentUserId, (int)KinectInterop.JointType.HipLeft);
Vector3 posHipRight = manager.GetJointPosition(currentUserId, (int)KinectInterop.JointType.HipRight);
Vector3 posHipCenter = (posHipLeft + posHipRight) / 2;
Vector3 posShoulderLeft = manager.GetJointPosition(currentUserId, (int)KinectInterop.JointType.ShoulderLeft);
Vector3 posShoulderRight = manager.GetJointPosition(currentUserId, (int)KinectInterop.JointType.ShoulderRight);
Vector3 posShoulderCenter = (posShoulderLeft + posShoulderRight) / 2;
height = (posShoulderCenter.y - posHipCenter.y) * scaleFactor;
return(true);
}
return(false);
}