本文整理汇总了C#中Microsoft.Kinect.Skeleton.GetDistance方法的典型用法代码示例。如果您正苦于以下问题:C# Skeleton.GetDistance方法的具体用法?C# Skeleton.GetDistance怎么用?C# Skeleton.GetDistance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Kinect.Skeleton
的用法示例。
在下文中一共展示了Skeleton.GetDistance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public override void Update(GameTime gameTime)
{
// hand.Update(gameTime);
//button.Update(gameTime);
//button.Clicked += button_Clicked;
gesture = kinect.Gesture;
if (FrameNumber % 240 == 0)
{
kinect.Gesture = "";
tvPopup.message = "";
}
if (FrameNumber % 120 == 0)
joiningHands = false;
if (voiceCommands != null)
{
if (voiceCommands.HeardString.Equals("Open"))
{
shouldPlay = true;
foreach (var player in players)
player.IsMuted = false;
}
if (voiceCommands.HeardString.Equals("Close"))
{
shouldPlay = false;
foreach (var player in players)
player.IsMuted = true;
}
}
//if (gesture.Equals("Zoom out"))
// joiningHands = true;
if (gesture.Equals("Joined Zoom"))
{
if (shouldPlay)
{
shouldPlay = false;
//player.Volume = 0;
foreach (var player in players)
player.IsMuted = true;
}
else
{
shouldPlay = true;
//player.Volume = tv.Volume / 100f;
foreach (var player in players)
player.IsMuted = false;
}
kinect.Gesture = "";
}
if(joinZoom!=null)
if (joinZoom.currentGesturePart >= 1 && joinZoom.currentGesturePart <= 10)
joiningHands = true;
if (joiningHands)
suppressUiTimer = 2;
if (suppressUiTimer > 0)
suppressUiTimer -= (float)gameTime.ElapsedGameTime.TotalSeconds;
skel = kinect.trackedSkeleton;
if ((skel != null))
//&& skel.Joints[JointType.WristLeft].Position.Y > skel.Joints[JointType.ElbowLeft].Position.Y) &&
//skel.Joints[JointType.WristRight].Position.Y > skel.Joints[JointType.ElbowRight].Position.Y)
{
leftAngle = skel.GetRotationZ2(JointType.WristLeft, JointType.HipLeft) + 0.32f;
if (skel.GetDistanceY(JointType.WristLeft, JointType.HipLeft) < 0)
leftAngle -= MathHelper.Pi;
leftAngle = MathHelper.Clamp(leftAngle, -MathHelper.PiOver2, MathHelper.PiOver2);
leftDist = skel.GetDistance(JointType.WristLeft, JointType.HipLeft, 'z') - 0.2f;
rightAngle = skel.GetRotationZ2(JointType.WristRight, JointType.HipRight) - 0.32f;
if (skel.GetDistanceY(JointType.WristRight, JointType.HipRight) < 0)
rightAngle += MathHelper.Pi;
rightAngle = MathHelper.Clamp(rightAngle, -MathHelper.PiOver2, MathHelper.PiOver2);
rightDist = skel.GetDistance(JointType.WristRight, JointType.HipRight, 'z') - 0.2f;
if (suppressUiTimer > 0 || !shouldPlay)
{
leftDist = 0;
rightDist = 0;
}
var lastCh = tv.Channel;
tv.UpdateValues(leftAngle, rightAngle, leftDist > 0, rightDist > 0);
foreach (var player in players)
player.Volume = (float)tv.Volume / 100;
if (tv.Channel != lastCh)
{
currentPlayer.Pause();
currentPlayer = players[tv.Channel - 1];
currentPlayer.Resume();
}
tvPopup.message = tv.Status;
}
base.Update(gameTime);
//.........这里部分代码省略.........