Kinect SDK player detection

后端 未结 1 1109
感动是毒
感动是毒 2020-12-04 02:07

I just created a 2 player game (like ShapeGame) but the problem is when one of the players lefts from the game scene, I can\'t detect which one (which player) le

1条回答
  •  有刺的猬
    2020-12-04 02:23

    Every player has an index in the Skeleton array:

    void nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e) {
        SkeletonFrame sf = e.SkeletonFrame;
        //check which skeletons in array are active and use that array indexes for player index
        SkeletonData player1 = sf.Skeletons[playerIndex1];
        SkeletonData player2 = sf.Skeletons[playerIndex2];
    

    You can use that index to identify your players if one leave and comes back.
    But if both players leave the sight of the Kinect it is not granted that the player index is correct when they enter the Kinect visibility again.

    0 讨论(0)
提交回复
热议问题