コード例 #1
0
        /// <summary>
        /// LerpAndApply performs a Lerp and applies the Lerped vector to the skeleton joint.
        /// </summary>
        /// <param name="skeleton">The skeleton.</param>
        /// <param name="jt">The joint type.</param>
        /// <param name="newJointVector">The new Vector3 value to lerp to.</param>
        /// <param name="lerpValue">The lerp amount between current and new Vector3.</param>
        /// <param name="finalTrackingState">The tracking state of the joint to set after lerp.</param>
        public static void LerpAndApply(Skeleton skeleton, JointType jt, Vector3 newJointVector, float lerpValue, JointTrackingState finalTrackingState)
        {
            if (null == skeleton)
            {
                return;
            }

            Joint         joint = skeleton.Joints[jt];
            SkeletonPoint pt    = KinectHelper.LerpVector(joint.Position, newJointVector, lerpValue);

            joint.Position      = pt;
            joint.TrackingState = finalTrackingState;
            skeleton.Joints[jt] = joint;
        }
コード例 #2
0
ファイル: AvatarAnimator.cs プロジェクト: RikeshThapa/VirtueX
        /// <summary>
        /// This method copies a new skeleton locally so we can modify it.
        /// </summary>
        /// <param name="sourceSkeleton">The skeleton to copy.</param>
        public void CopySkeleton(Skeleton sourceSkeleton)
        {
            if (null == sourceSkeleton)
            {
                return;
            }

            if (null == this.skeleton)
            {
                this.skeleton = new Skeleton();
            }

            // Copy the raw Kinect skeleton so we can modify the joint data and apply constraints
            KinectHelper.CopySkeleton(sourceSkeleton, this.skeleton);
        }