本文整理汇总了C#中KinectWrapper类的典型用法代码示例。如果您正苦于以下问题:C# KinectWrapper类的具体用法?C# KinectWrapper怎么用?C# KinectWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KinectWrapper类属于命名空间,在下文中一共展示了KinectWrapper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GestureCompleted
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture,
KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
{
if (gesture == KinectGestures.Gestures.SwipeLeft && Cart.scene2) {
Debug.Log("Swipe Left Completed!");
GameObject.FindObjectOfType<Shelf>().SwipeLeft();
}
if (gesture == KinectGestures.Gestures.SwipeRight && Cart.scene2) {
//Debug.Log("Swipe Left Completed!");
GameObject.FindObjectOfType<Cart>().SwipeRight();
Debug.Log("Swipe Right Completed!");
}
string sGestureText = gesture + " detected";
if(gesture == KinectGestures.Gestures.Click)
sGestureText += string.Format(" at ({0:F1}, {1:F1})", screenPos.x, screenPos.y);
if(GestureInfo != null)
GestureInfo.GetComponent<GUIText>().text = sGestureText;
progressDisplayed = false;
return true;
}
开发者ID:Evi91,项目名称:menu,代码行数:25,代码来源:SimpleGestureListener.cs
示例2: CopySkeleton
// CopySkeleton copies the data from another skeleton.
public static void CopySkeleton(ref KinectWrapper.NuiSkeletonData source, ref KinectWrapper.NuiSkeletonData destination)
{
// if (null == source)
// {
// return;
// }
//
// if (null == destination)
// {
// destination = new Skeleton();
// }
destination.eTrackingState = source.eTrackingState;
destination.dwTrackingID = source.dwTrackingID;
destination.Position = source.Position;
destination.dwQualityFlags = source.dwQualityFlags;
int jointsCount = (int)KinectWrapper.NuiSkeletonPositionIndex.Count;
if(destination.SkeletonPositions == null)
destination.SkeletonPositions = new Vector4[jointsCount];
if(destination.eSkeletonPositionTrackingState == null)
destination.eSkeletonPositionTrackingState = new KinectWrapper.NuiSkeletonPositionTrackingState[jointsCount];
for(int jointIndex = 0; jointIndex < jointsCount; jointIndex++)
{
destination.SkeletonPositions[jointIndex] = source.SkeletonPositions[jointIndex];
destination.eSkeletonPositionTrackingState[jointIndex] = source.eSkeletonPositionTrackingState[jointIndex];
}
}
开发者ID:vanstorm9,项目名称:KinectSwordFight,代码行数:31,代码来源:KinectHelper.cs
示例3: Init
// Initialize the filter with a set of TransformSmoothParameters.
public void Init(KinectWrapper.NuiTransformSmoothParameters smoothingParameters)
{
this.smoothParameters = smoothingParameters;
this.Reset();
this.init = true;
}
开发者ID:ranguera,项目名称:Kinect-DAT,代码行数:8,代码来源:TrackingStateFilter.cs
示例4: Constrain
// ConstrainSelfIntersection collides joints with the skeleton to keep the skeleton's hands and wrists from puncturing its body
// A cylinder is created to represent the torso. Intersecting joints have their positions changed to push them outside the torso.
public void Constrain(ref KinectWrapper.NuiSkeletonData skeleton)
{
// if (null == skeleton)
// {
// return;
// }
int shoulderCenterIndex = (int)KinectWrapper.NuiSkeletonPositionIndex.ShoulderCenter;
int hipCenterIndex = (int)KinectWrapper.NuiSkeletonPositionIndex.HipCenter;
if (skeleton.eSkeletonPositionTrackingState[shoulderCenterIndex] != KinectWrapper.NuiSkeletonPositionTrackingState.NotTracked &&
skeleton.eSkeletonPositionTrackingState[hipCenterIndex] != KinectWrapper.NuiSkeletonPositionTrackingState.NotTracked)
{
Vector3 shoulderDiffLeft = KinectHelper.VectorBetween(ref skeleton, shoulderCenterIndex, (int)KinectWrapper.NuiSkeletonPositionIndex.ShoulderLeft);
Vector3 shoulderDiffRight = KinectHelper.VectorBetween(ref skeleton, shoulderCenterIndex, (int)KinectWrapper.NuiSkeletonPositionIndex.ShoulderRight);
float shoulderLengthLeft = shoulderDiffLeft.magnitude;
float shoulderLengthRight = shoulderDiffRight.magnitude;
// The distance between shoulders is averaged for the radius
float cylinderRadius = (shoulderLengthLeft + shoulderLengthRight) * 0.5f;
// Calculate the shoulder center and the hip center. Extend them up and down respectively.
Vector3 shoulderCenter = (Vector3)skeleton.SkeletonPositions[shoulderCenterIndex];
Vector3 hipCenter = (Vector3)skeleton.SkeletonPositions[hipCenterIndex];
Vector3 hipShoulder = hipCenter - shoulderCenter;
hipShoulder.Normalize();
shoulderCenter = shoulderCenter - (hipShoulder * (ShoulderExtend * cylinderRadius));
hipCenter = hipCenter + (hipShoulder * (HipExtend * cylinderRadius));
// Optionally increase radius to account for bulky avatars
cylinderRadius *= RadiusMultiplier;
// joints to collide
int[] collisionIndices =
{
(int)KinectWrapper.NuiSkeletonPositionIndex.WristLeft,
(int)KinectWrapper.NuiSkeletonPositionIndex.HandLeft,
(int)KinectWrapper.NuiSkeletonPositionIndex.WristRight,
(int)KinectWrapper.NuiSkeletonPositionIndex.HandRight
};
foreach (int j in collisionIndices)
{
Vector3 collisionJoint = (Vector3)skeleton.SkeletonPositions[j];
Vector4 distanceNormal = KinectHelper.DistanceToLineSegment(shoulderCenter, hipCenter, collisionJoint);
Vector3 normal = new Vector3(distanceNormal.x, distanceNormal.y, distanceNormal.z);
// if distance is within the cylinder then push the joint out and away from the cylinder
if (distanceNormal.w < cylinderRadius)
{
collisionJoint += normal * ((cylinderRadius - distanceNormal.w) * CollisionTolerance);
skeleton.SkeletonPositions[j] = (Vector4)collisionJoint;
}
}
}
}
开发者ID:ReaperCZ,项目名称:UnityTemp,代码行数:62,代码来源:SelfIntersectionConstraint.cs
示例5: GestureCompleted
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture,
KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
{
string sGestureText = gesture + " detected";
if (gesture == KinectGestures.Gestures.Click) {
sGestureText += string.Format (" at ({0:F1}, {1:F1})", screenPos.x, screenPos.y);
print ("CLICKED DOWN???!?!?!?!?!"); //reverse units
print ("SCREEN POS: " + screenPos);
clickedPos.x = screenPos.x;
clickedPos.y = screenPos.y;
GetComponent<LineGame> ().kinectClickedOn = true;
GetComponent<LineGame> ().clickedPos = clickedPos;
GetComponent<Main> ().kinectClickedOn = true;
GetComponent<Main> ().clickedPos = clickedPos;
GetComponent<GrowingTeamGame> ().kinectClickedOn = true;
GetComponent<GrowingTeamGame> ().clickedPos = clickedPos;
GetComponent<AquariumGame> ().kinectClickedOn = true;
GetComponent<AquariumGame> ().clickedPos = clickedPos;
}
if(GestureInfo != null)
GestureInfo.GetComponent<GUIText>().text = sGestureText;
progressDisplayed = false;
return true;
}
开发者ID:EECS481AquaTeam,项目名称:Aquarium,代码行数:27,代码来源:SimpleGestureListener.cs
示例6: GestureCompleted
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture,
KinectWrapper.SkeletonJoint joint, Vector3 screenPos)
{
KinectManager manager = KinectManager.Instance;
string sGestureText = gesture + " detected";
if(GestureInfo != null)
{
GestureInfo.guiText.text = sGestureText;
}
if (gesture == KinectGestures.Gestures.SwipeLeft)
swipeLeft = true;
else if (gesture == KinectGestures.Gestures.SwipeRight)
swipeRight = true;
//else if(gesture == KinectGestures.Gestures.RaiseLeftHand)
// RaiseLeftHand = true;
//else if(gesture == KinectGestures.Gestures.RaiseRightHand)
// RaiseRightHand = true;
else if (gesture == KinectGestures.Gestures.Push)
Push = true;
else if (gesture == KinectGestures.Gestures.Psi)
PSI = true;
else if (gesture == KinectGestures.Gestures.Wave)
Wave = true;
return true;
}
开发者ID:jsnulla,项目名称:IFX,代码行数:26,代码来源:GestureListener.cs
示例7: GestureInProgress
public void GestureInProgress(uint userId, int userIndex, KinectGestures.Gestures gesture,
float progress, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
{
//GestureInfo.guiText.text = string.Format("{0} Progress: {1:F1}%", gesture, (progress * 100));
if(gesture == KinectGestures.Gestures.Click && progress > 0.3f)
{
string sGestureText = string.Format ("{0} {1:F1}% complete", gesture, progress * 100);
if(GestureInfo != null)
GestureInfo.GetComponent<GUIText>().text = sGestureText;
progressDisplayed = true;
}
else if((gesture == KinectGestures.Gestures.ZoomOut || gesture == KinectGestures.Gestures.ZoomIn) && progress > 0.5f)
{
string sGestureText = string.Format ("{0} detected, zoom={1:F1}%", gesture, screenPos.z * 100);
if(GestureInfo != null)
GestureInfo.GetComponent<GUIText>().text = sGestureText;
progressDisplayed = true;
}
else if(gesture == KinectGestures.Gestures.Wheel && progress > 0.5f)
{
string sGestureText = string.Format ("{0} detected, angle={1:F1} deg", gesture, screenPos.z);
if(GestureInfo != null)
GestureInfo.GetComponent<GUIText>().text = sGestureText;
progressDisplayed = true;
}
}
开发者ID:PC-Yolger,项目名称:Tesis-de-Grado---Unity-and-Kinect,代码行数:29,代码来源:SimpleGestureListener.cs
示例8: GestureCompleted
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture,
KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
{
string sGestureText = gesture + " detected";
if(GestureInfo != null)
{
GestureInfo.guiText.text = sGestureText;
}
if(gesture == KinectGestures.Gestures.SwipeLeft)
{
swipeLeft = true;
}
if(gesture == KinectGestures.Gestures.SwipeRight)
{
swipeRight = true;
}
if(gesture == KinectGestures.Gestures.SwipeUp)
{
swipeUp = true;
}
if(gesture == KinectGestures.Gestures.SwipeDown)
{
swipeDown = true;
}
if(gesture == KinectGestures.Gestures.Push)
{
push = true;
}
if(gesture == KinectGestures.Gestures.Pull)
{
pull = true;
}
return true;
}
开发者ID:songwanfu,项目名称:MotionSensing3DSolarSystem,代码行数:35,代码来源:GestureListener1.cs
示例9: PoseAngle
public PoseAngle(KinectWrapper.NuiSkeletonPositionIndex centerJoint, KinectWrapper.NuiSkeletonPositionIndex angleJoint,
double angle, double threshold)
{
CenterJoint = centerJoint;
AngleJoint = angleJoint;
Angle = angle;
Threshold = threshold;
}
开发者ID:jaredbruhn,项目名称:KinectPose,代码行数:8,代码来源:PoseAngle.cs
示例10: IsTrackedOrInferred
// IsTrackedOrInferred checks whether the skeleton joint is tracked or inferred.
public static bool IsTrackedOrInferred(KinectWrapper.NuiSkeletonData skeleton, int jointIndex)
{
// if (null == skeleton)
// {
// return false;
// }
return skeleton.eSkeletonPositionTrackingState[jointIndex] != KinectWrapper.NuiSkeletonPositionTrackingState.NotTracked;
}
开发者ID:ReaperCZ,项目名称:UnityTemp,代码行数:10,代码来源:KinectHelper.cs
示例11: JointConstraint
public JointConstraint( KinectWrapper.Joints joint_a,
KinectWrapper.Joints joint_b,
Relations relation,
Operators operation,
Vector3 val )
{
this.joint_a = joint_a;
this.joint_b = joint_b;
this.relation = relation;
this.operation = operation;
this.val = val;
}
开发者ID:vladotrocol,项目名称:van-dyke,代码行数:12,代码来源:JointConstraint.cs
示例12: GestureInProgress
public void GestureInProgress(uint userId, int userIndex, KinectGestures.Gestures gesture,
float progress, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
{
if (gesture == KinectGestures.Gestures.SwipeLeft)
{
//Debug.Log("SwipeLeft " + progress + " Screen Pos: "+ screenPos + " Gesture: " + gesture);
}
if (gesture == KinectGestures.Gestures.SwipeRight)
{
//Debug.Log("SwipeRight " + progress + " Screen Pos: "+ screenPos + " Gesture: " + gesture);
}
}
开发者ID:Evi91,项目名称:menu,代码行数:12,代码来源:MineGestureListener.cs
示例13: LerpAndApply
// LerpAndApply performs a Lerp and applies the Lerped vector to the skeleton joint.
public static void LerpAndApply(ref KinectWrapper.NuiSkeletonData skeleton, int jointIndex, Vector3 newJointPos, float lerpValue, KinectWrapper.NuiSkeletonPositionTrackingState finalTrackingState)
{
// if (null == skeleton)
// {
// return;
// }
Vector3 jointPos = (Vector3)skeleton.SkeletonPositions[jointIndex];
jointPos = Vector3.Lerp(jointPos, newJointPos, lerpValue);
skeleton.SkeletonPositions[jointIndex] = (Vector4)jointPos;
skeleton.eSkeletonPositionTrackingState[jointIndex] = finalTrackingState;
}
开发者ID:ReaperCZ,项目名称:UnityTemp,代码行数:14,代码来源:KinectHelper.cs
示例14: GestureCompleted
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture,
KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
{
string sGestureText = gesture + " detected";
if(gesture == KinectGestures.Gestures.Click)
sGestureText += string.Format(" at ({0:F1}, {1:F1})", screenPos.x, screenPos.y);
if(GestureInfo != null)
GestureInfo.GetComponent<GUIText>().text = sGestureText;
progressDisplayed = false;
return true;
}
开发者ID:PC-Yolger,项目名称:Tesis-de-Grado---Unity-and-Kinect,代码行数:14,代码来源:SimpleGestureListener.cs
示例15: GestureCancelled
public bool GestureCancelled(uint userId, int userIndex, KinectGestures.Gestures gesture,
KinectWrapper.NuiSkeletonPositionIndex joint)
{
if(progressDisplayed)
{
// clear the progress info
if(GestureInfo != null)
GestureInfo.GetComponent<GUIText>().text = String.Empty;
progressDisplayed = false;
}
return true;
}
开发者ID:PC-Yolger,项目名称:Tesis-de-Grado---Unity-and-Kinect,代码行数:14,代码来源:SimpleGestureListener.cs
示例16: GestureCancelled
public bool GestureCancelled (uint userId, int userIndex, KinectGestures.Gestures gesture,
KinectWrapper.SkeletonJoint joint)
{
if(progressDisplayed)
{
// clear the progress info
if(GestureInfo != null)
GestureInfo.guiText.text = String.Empty;
progressDisplayed = false;
}
return true;
}
开发者ID:ZuomingShi,项目名称:UMC,代码行数:14,代码来源:SimpleGestureListener.cs
示例17: UpdateFilter
// Update the filter with a new frame of data and smooth.
public void UpdateFilter(ref KinectWrapper.NuiSkeletonData skeleton)
{
// if (null == skeleton)
// {
// return;
// }
if (skeleton.eTrackingState != KinectWrapper.NuiSkeletonTrackingState.SkeletonTracked)
{
return;
}
if (this.init == false)
{
this.Init(); // initialize with default parameters
}
//Array jointTypeValues = Enum.GetValues(typeof(KinectWrapper.NuiSkeletonPositionIndex));
KinectWrapper.NuiTransformSmoothParameters tempSmoothingParams = new KinectWrapper.NuiTransformSmoothParameters();
// Check for divide by zero. Use an epsilon of a 10th of a millimeter
this.smoothParameters.fJitterRadius = Math.Max(0.0001f, this.smoothParameters.fJitterRadius);
tempSmoothingParams.fSmoothing = smoothParameters.fSmoothing;
tempSmoothingParams.fCorrection = smoothParameters.fCorrection;
tempSmoothingParams.fPrediction = smoothParameters.fPrediction;
int jointsCount = (int)KinectWrapper.NuiSkeletonPositionIndex.Count;
for(int jointIndex = 0; jointIndex < jointsCount; jointIndex++)
{
//KinectWrapper.NuiSkeletonPositionIndex jt = (KinectWrapper.NuiSkeletonPositionIndex)jointTypeValues.GetValue(jointIndex);
// If not tracked, we smooth a bit more by using a bigger jitter radius
// Always filter feet highly as they are so noisy
if (skeleton.eSkeletonPositionTrackingState[jointIndex] != KinectWrapper.NuiSkeletonPositionTrackingState.Tracked)
{
tempSmoothingParams.fJitterRadius = smoothParameters.fJitterRadius * 2.0f;
tempSmoothingParams.fMaxDeviationRadius = smoothParameters.fMaxDeviationRadius * 2.0f;
}
else
{
tempSmoothingParams.fJitterRadius = smoothParameters.fJitterRadius;
tempSmoothingParams.fMaxDeviationRadius = smoothParameters.fMaxDeviationRadius;
}
FilterJoint(ref skeleton, jointIndex, ref tempSmoothingParams);
}
}
开发者ID:ReaperCZ,项目名称:UnityTemp,代码行数:50,代码来源:JointPositionsFilter.cs
示例18: GestureCompleted
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture,
KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
{
string sGestureText = gesture + " detected";
if(GestureInfo != null)
{
GestureInfo.GetComponent<GUIText>().text = sGestureText;
}
if(gesture == KinectGestures.Gestures.SwipeLeft)
swipeLeft = true;
else if(gesture == KinectGestures.Gestures.SwipeRight)
swipeRight = true;
return true;
}
开发者ID:vanstorm9,项目名称:KinectSwordFight,代码行数:16,代码来源:GestureListener.cs
示例19: GestureCompleted
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture,
KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
{
Debug.Log ("A gesture!");
switch (currentRoom) {
case Scene.Setup:
Debug.Log ("A gesture in setup no less.");
currentRoom = Scene.Setup;
setupGameController.ReceiveGesture (gesture);
break;
case Scene.Model_Room:
currentRoom = Scene.Model_Room;
gameController.ReceiveGesture (gesture);
break;
}
return true;
}
开发者ID:christuart,项目名称:EDSAC-Project-Summer-2015,代码行数:17,代码来源:GestureHandler.cs
示例20: GestureCompleted
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture,
KinectWrapper.SkeletonJoint joint, Vector3 screenPos)
{
string sGestureText = gesture + " detected";
if(GestureInfo != null)
{
GestureInfo.guiText.text = sGestureText;
}
if(gesture == KinectGestures.Gestures.SwipeLeft)
swipeLeft = true;
else if(gesture == KinectGestures.Gestures.SwipeRight)
swipeRight = true;
else if(gesture == KinectGestures.Gestures.ZoomOut)
zoomOut = true;
else if(gesture == KinectGestures.Gestures.ZoomIn)
zoomIn = true;
return true;
}
开发者ID:kockaart,项目名称:viewing-angle-Assets,代码行数:20,代码来源:GestureListener.cs
注:本文中的KinectWrapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论