Kinect.KinectManager.GetDirectionBetweenJoints C# (CSharp) Method

GetDirectionBetweenJoints() public method

Gets the direction between the given joints of the specified user.
public GetDirectionBetweenJoints ( Int64 userId, int firstJoint, int secondJoint, bool flipX, bool flipZ ) : Vector3
userId Int64 User ID
firstJoint int First joint index
secondJoint int Second joint index
flipX bool If set to true flips the X-coordinate
flipZ bool If set to true flips the Z-coordinate
return UnityEngine.Vector3
        public Vector3 GetDirectionBetweenJoints(Int64 userId, int firstJoint, int secondJoint, bool flipX, bool flipZ)
        {
            if (dictUserIdToIndex.ContainsKey(userId))
            {
                int index = dictUserIdToIndex[userId];

                if (index >= 0 && index < sensorData.bodyCount &&
                    bodyFrame.bodyData[index].bIsTracked != 0)
                {
                    KinectInterop.BodyData bodyData = bodyFrame.bodyData[index];

                    if (firstJoint >= 0 && firstJoint < sensorData.jointCount &&
                        secondJoint >= 0 && secondJoint < sensorData.jointCount)
                    {
                        Vector3 firstJointPos = bodyData.joint[firstJoint].position;
                        Vector3 secondJointPos = bodyData.joint[secondJoint].position;
                        Vector3 jointDir = secondJointPos - firstJointPos;

                        if (flipX)
                            jointDir.x = -jointDir.x;

                        if (flipZ)
                            jointDir.z = -jointDir.z;

                        return jointDir;
                    }
                }
            }

            return Vector3.zero;
        }
KinectManager