public MoCapKinectBoneHierarchyNode this[MoCapKinectBone bone]
        {
            get
            {
                if (!MoCapBoneMapper.IsValidKinectBone(bone))
                {
                    throw new ArgumentException("Invalid Kinect bone!");
                }

                if (Current == bone)
                {
                    return(this);
                }

                foreach (var child in Children)
                {
                    var value = child[bone];
                    if (value != null)
                    {
                        return(value);
                    }
                }

                return(null);
            }
        }
Пример #2
0
        static MoCapBoneCalibration()
        {
            Default = new MoCapBoneCalibration
            {
                Calibration = new MoCapBoneCalibrationUnit[(int)MoCapKinectBone.Count]
            };

            foreach (MoCapKinectBone bone in Enum.GetValues(typeof(MoCapKinectBone)))
            {
                if (MoCapBoneMapper.IsValidKinectBone(bone))
                {
                    Default.Calibration[(int)bone].Unit = Quaternion.Identity;
                }
            }

            Default.Calibration[(int)MoCapKinectBone.ShoulderLeft].Unit  = Quaternion.AxisAngle(Vector3.Up, -180.0f);
            Default.Calibration[(int)MoCapKinectBone.ShoulderRight].Unit = Quaternion.AxisAngle(Vector3.Up, 180.0f);
            Default.Calibration[(int)MoCapKinectBone.ElbowLeft].Unit     = Quaternion.AxisAngle(Vector3.Up, -90.0f);
            Default.Calibration[(int)MoCapKinectBone.ElbowRight].Unit    = Quaternion.AxisAngle(Vector3.Up, 90.0f);
            Default.Calibration[(int)MoCapKinectBone.WristLeft].Unit     = Quaternion.AxisAngle(Vector3.Up, 180.0f);
            Default.Calibration[(int)MoCapKinectBone.WristRight].Unit    = Quaternion.AxisAngle(Vector3.Up, -180.0f);
            Default.Calibration[(int)MoCapKinectBone.HandLeft].Unit      = Quaternion.AxisAngle(Vector3.Up, 90.0f);
            Default.Calibration[(int)MoCapKinectBone.HandRight].Unit     = Quaternion.AxisAngle(Vector3.Up, -90.0f);

            Default.Calibration[(int)MoCapKinectBone.KneeLeft].Unit   = Quaternion.AxisAngle(Vector3.Up, 90.0f);
            Default.Calibration[(int)MoCapKinectBone.KneeRight].Unit  = Quaternion.AxisAngle(Vector3.Up, -90.0f);
            Default.Calibration[(int)MoCapKinectBone.AnkleLeft].Unit  = Quaternion.AxisAngle(Vector3.Up, 90.0f);
            Default.Calibration[(int)MoCapKinectBone.AnkleRight].Unit = Quaternion.AxisAngle(Vector3.Up, -90.0f);
            Default.Calibration[(int)MoCapKinectBone.FootLeft].Unit   = Quaternion.AxisAngle(Vector3.Right, -90.0f);
            Default.Calibration[(int)MoCapKinectBone.FootRight].Unit  = Quaternion.AxisAngle(Vector3.Right, -90.0f);
        }
Пример #3
0
        static MoCapBoneConstraint()
        {
            Default = new MoCapBoneConstraint
            {
                Constraint = new MoCapBoneConstraintUnit[(int)MoCapKinectBone.Count]
            };

            foreach (MoCapKinectBone bone in Enum.GetValues(typeof(MoCapKinectBone)))
            {
                if (MoCapBoneMapper.IsValidKinectBone(bone))
                {
                    Default.Constraint[(int)bone].Min = -180.0f * Vector3.One;
                    Default.Constraint[(int)bone].Max = 180.0f * Vector3.One;
                }
            }
        }