资源简介

KinectWrapperPackage替换文件,替换KinectInterop.cs和KinectSensor.cs这两个文件,使unity3d支持Kinect SDK1.7,(1.6测试正常使用,1.8未测试) 本资源与Blog《Kinect开发之结合Unity3D进行游戏应用开发》配套。 如果您下载到了本资源。请去blog上看原文,方便一起学习交流。 http://yacare.iteye.com/blog/1950164

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using UnityEngine;
                
namespace Kinect {
                    
    public interface KinectInterface {
                        
        float getSensorHeight();
        Vector3 getKinectCenter();
        Vector4 getLookAt();
                        
        bool pollSkeleton();
        NuiSkeletonframe getSkeleton();
                        
        bool pollColor();
        Color32[] getColor();
        bool pollDepth();
        short[] getDepth();
    }
                    
    public static class Constants
    {
        public static int NuiSkeletonCount = 6;
        public static int NuiSkeletonMaxTracked = 2;
        public static int NuiSkeletonInvalidTrackingID = 0;
                        
        public static float NuiDepthHorizontalFOV = 58.5f;
        public static float NuiDepthVerticalFOV = 45.6f;
    }
                    
    /// 
    ///Structs and constants for interfacing c# with the c++ kinect dll 
    /// 

                
    [Flags]
    public enum NuiInitializeFlags : uint
    {
        UsesDepthAndPlayerIndex = 0x00000001
        UsesColor = 0x00000002
        UsesSkeleton = 0x00000008
        UsesDepth = 0x00000020
    }
                
    public enum NuiSkeletonPositionIndex : int
    {
        HipCenter = 0
        Spine
        ShoulderCenter
        Head
        ShoulderLeft
        ElbowLeft
        WristLeft
        HandLeft
        ShoulderRight
        ElbowRight
        WristRight
        HandRight
        HipLeft
        KneeLeft
        AnkleLeft
        FootLeft
        HipRight
        KneeRight
        AnkleRight
        FootRight
        Count
    }
                
    public enum NuiSkeletonPositionTrackingState
    {
        NotTracked = 0
        Inferred
        Tracked
    }
                
    public enum NuiSkeletonTrackingState
    {
        NotTracked = 0
        PositionOnly
        SkeletonTracked
    }
                    
    public enum NuiImageType
    {
        DepthAndPlayerIndex = 0    // USHORT
        Color                      // RGB32 data
        ColorYUV                   // YUY2 stream from camera h/w but converted to RGB32 before user getting it.
        ColorRawYUV                // YUY2 stream from camera h/w.
        Depth                       // USHORT
    }
                    
    public enum NuiImageResolution
    {
        resolutionInvalid = -1
        resolution80x60 = 0
        resolution320x240
        resolution640x480
        resolution1280x1024                        // for hires color only
    }
                
    /*[StructLayoutAttribute(LayoutKind.Sequential)]
    public struct Vector4
    {
        public float x;
        public float y;
        public float z;
        public float w;
    }*/
                
    [StructLayoutAttribute(LayoutKind.Sequential)]
    publ

评论

共有 条评论