Kinect.KinectManager.GetJointDirection C# (CSharp) Method

GetJointDirection() public method

Gets the joint direction of the specified user, relative to its parent joint.
public GetJointDirection ( Int64 userId, int joint, bool flipX, bool flipZ ) : Vector3
userId Int64 User ID
joint int 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 GetJointDirection(Int64 userId, int joint, bool flipX, bool flipZ)
        {
            if (dictUserIdToIndex.ContainsKey(userId))
            {
                int index = dictUserIdToIndex[userId];

                if (index >= 0 && index < sensorData.bodyCount &&
                    bodyFrame.bodyData[index].bIsTracked != 0)
                {
                    if (joint >= 0 && joint < sensorData.jointCount)
                    {
                        KinectInterop.JointData jointData = bodyFrame.bodyData[index].joint[joint];
                        Vector3 jointDir = jointData.direction;

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

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

                        return jointDir;
                    }
                }
            }

            return Vector3.zero;
        }
KinectManager