KinectManager.GetUserPosition C# (CSharp) Method

GetUserPosition() public method

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

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

Usage Example

Example #1
0
    public void playerSideAdjuster()
    {
        var p1id = _KinectManager.GetUserIdByIndex(0);
        var p2id = _KinectManager.GetUserIdByIndex(1);


        //player1.isRight = false;//temporary for testing

        if (p1id != 0 && p2id != 0)
        {
            var p1pos = _KinectManager.GetUserPosition(p1id);
            var p2pos = _KinectManager.GetUserPosition(p2id);
            //Debug.Log("p1pos="+p1pos);
            //Debug.Log("p2pos="+p2pos);

            if (p1pos.x <= p2pos.x)
            {
                player1.isRight            = false;
                player2.isRight            = true;
                player1.gripHandTexture    = leftMostHand[0];
                player1.releaseHandTexture = leftMostHand[1];
                player1.normalHandTexture  = leftMostHand[2];

                player2.gripHandTexture    = RightMostHand[0];
                player2.releaseHandTexture = RightMostHand[1];
                player2.normalHandTexture  = RightMostHand[2];

                //player1.playerIndex=0;
                //player2.playerIndex=1;
            }
            else
            {
                player1.isRight            = true;
                player2.isRight            = false;
                player2.gripHandTexture    = leftMostHand[0];
                player2.releaseHandTexture = leftMostHand[1];
                player2.normalHandTexture  = leftMostHand[2];

                player1.gripHandTexture    = RightMostHand[0];
                player1.releaseHandTexture = RightMostHand[1];
                player1.normalHandTexture  = RightMostHand[2];


                //player1.playerIndex=1;
                //player2.playerIndex=0;
            }
        }
    }
All Usage Examples Of KinectManager::GetUserPosition