KinectManager.GetJointPosition C# (CSharp) Method

GetJointPosition() public method

public GetJointPosition ( uint UserId, int joint ) : Vector3
UserId uint
joint int
return Vector3
    public Vector3 GetJointPosition(uint UserId, int joint)
    {
        KinectWrapper.GetJointTransformation(UserId, joint, ref jointTransform);
        KinectWrapper.SkeletonJointPosition pos = jointTransform.pos;

        return new Vector3(pos.x * 0.001f, pos.y * 0.001f, pos.z * 0.001f);
    }

Usage Example

    public void FloatWithArm()
    {
        KinectInterop.JointType handJoint     = KinectInterop.JointType.HandRight;
        KinectInterop.JointType shoulderJoint = KinectInterop.JointType.ShoulderRight;
        KinectManager           manager       = KinectManager.Instance;

        if (manager && manager.IsInitialized())
        {
            if (manager.IsUserDetected())
            {
                long    userId = manager.GetPrimaryUserID();
                Vector3 handPos, shoulderPos;
                if (manager.IsJointTracked(userId, (int)shoulderJoint))
                {
                    shoulderPos = manager.GetJointPosition(userId, (int)shoulderJoint);
                    if (manager.IsJointTracked(userId, (int)handJoint))
                    {
                        handPos   = manager.GetJointPosition(userId, (int)handJoint);
                        armEffect = new Vector3(-3 * (handPos.x - shoulderPos.x), 3 * (handPos.y - shoulderPos.y), -3 * (handPos.z - shoulderPos.z));
                        ParticleSystem.VelocityOverLifetimeModule module = particle.velocityOverLifetime;
                    }
                }
            }
        }
    }
All Usage Examples Of KinectManager::GetJointPosition