• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# KinectManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中KinectManager的典型用法代码示例。如果您正苦于以下问题:C# KinectManager类的具体用法?C# KinectManager怎么用?C# KinectManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



KinectManager类属于命名空间,在下文中一共展示了KinectManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: init

 /*******************************/
 /*  Fonction d'initialisation  */
 /*******************************/
 /** \brief Fonction d'initialisation de la Bullet
  *  \param d : Mouvement à associer au Bullet
  */
 public void init(KinectManager.Direction d)
 {
     if (KinectManager.Instance == null) {                                           // Vérification de l'existence du KinectManager
         Debug.LogError("MovementManager wasn't initialized");                       // Si absent, erreur
         return;
     }
     else {                                                                          // Si présent
         switch (d) {                                                                // Suivant le mouvement demandé
             case KinectManager.Direction.Up:
                 KinectManager.Instance.onPlayerMovementUpEvent += onDirection;      // On s'inscrit à l'évènement correspondant
                 GetComponent<Renderer>().material.color = new Color(1, 0.4f, 0.4f);    // Rouge clair
                 break;
             case KinectManager.Direction.Left:
                 KinectManager.Instance.onPlayerMovementLeftEvent += onDirection;
                 GetComponent<Renderer>().material.color = new Color(1, 0.4f, 0.4f);
                 break;
             case KinectManager.Direction.Right:
                 KinectManager.Instance.onPlayerMovementRightEvent += onDirection;
                 GetComponent<Renderer>().material.color = new Color(1, 0.4f, 0.4f);
                 break;
             case KinectManager.Direction.BonusUp:
                 KinectManager.Instance.onPlayerMovementBonusUpEvent += onDirection;
                 GetComponent<Renderer>().material.color = new Color(0.4f, 0.4f, 1); // bleu clair
                 break;
             case KinectManager.Direction.BonusDown:
                 KinectManager.Instance.onPlayerMovementBonusDownEvent += onDirection;
                 GetComponent<Renderer>().material.color = new Color(0.4f, 0.4f, 1); ;
                 break;
         }
     }
     direction = d;                                                                  // On mémorise le mouvement
     initialized = true;                                                             // On indique que l'initialisation a eu lieu
 }
开发者ID:descorps,项目名称:ProjetKinect,代码行数:39,代码来源:Bullet.cs


示例2: HandIsGrabbing

 private bool HandIsGrabbing(KinectManager km)
 {
     if (kinectInterpreter.useGamepad) {
         if (isLeftHand) {
             return Input.GetAxis("Horizontal" + kinectInterpreter.gamepad) != 0f || Input.GetAxis("Vertical" + kinectInterpreter.gamepad) != 0f;
         } else {
             return false;
         }
     } else {
         if (isLeftHand) {
             if (km.GetLeftHandState (userId) != KinectInterop.HandState.Closed || km.GetRightHandState (userId) == KinectInterop.HandState.Closed) {
                 dragBuffer = 0;
                 return false;
             }
         } else {
             if (km.GetRightHandState (userId) != KinectInterop.HandState.Closed || km.GetLeftHandState (userId) == KinectInterop.HandState.Closed) {
                 dragBuffer = 0;
                 return false;
             }
         }
         if (dragBuffer < dragBufferTriggerSize)
             dragBuffer++;
         return dragBuffer == dragBufferTriggerSize;
     }
 }
开发者ID:christuart,项目名称:Meet-EDSAC,代码行数:25,代码来源:KinectDragController.cs


示例3: Update

	void Update () 
	{
		if(manager == null)
		{
			manager = KinectManager.Instance;
		}

		if(manager && manager.IsInitialized() && foregroundCamera)
		{
			//backgroundImage.renderer.material.mainTexture = manager.GetUsersClrTex();
			if(backgroundImage && (backgroundImage.texture == null))
			{
				backgroundImage.texture = manager.GetUsersClrTex();
			}

			// get the background rectangle (use the portrait background, if available)
			Rect backgroundRect = foregroundCamera.pixelRect;
			PortraitBackground portraitBack = PortraitBackground.Instance;

			if(portraitBack && portraitBack.enabled)
			{
				backgroundRect = portraitBack.GetBackgroundRect();
			}

			// overlay the joints
			if(manager.IsUserDetected())
			{
				long userId = manager.GetUserIdByIndex(playerIndex);

				OverlayJoint(userId, (int)KinectInterop.JointType.HandLeft, leftHandOverlay, backgroundRect);
				OverlayJoint(userId, (int)KinectInterop.JointType.HandRight, rightHandOverlay, backgroundRect);
			}
			
		}
	}
开发者ID:anteaterho,项目名称:SpoutTestTemp,代码行数:35,代码来源:HandColorOverlayer.cs


示例4: Update

    // Update is called once per frame
    void Update()
    {
        // Find the kinectManager object
        GameObject KM = GameObject.FindGameObjectWithTag("KinectManager");
        _testObject = KM.GetComponent<KinectManager>();

        //-----------------------
        // Get all positions from the Kinect Manager
        Result result1 = _testObject.getBodyPos();
        if(result1.Success)
        {
            //Debug.Log(result1.AccessToken);
        }
        else
        {
            //If u like to do something when we do not have a position from the kinect
        }

        //-----------------------
        // Get a sertain position from the Kinect Manager
        Result result2 = _testObject.getBodyPartPos(KinectJT.HandRight);
        if (result2.Success)
        {
            Debug.Log(result2.AccessToken[0]);
        }
        else
        {
            //If u like to do something when we do not have a position from the kinect
        }
    }
开发者ID:stefanseibert,项目名称:padawan101,代码行数:31,代码来源:testCallKinect.cs


示例5: SencerInitialize

    // Use this for initialization
    public void SencerInitialize()
    {
        // キネクトマネージャーの取得
        manager = KinectManager.Instance;

        if (manager && manager.IsInitialized ()) {
            KinectInterop.SensorData sensorData = manager.GetSensorData ();

            if (sensorData != null && sensorData.sensorInterface != null) {
                // get depth image size
                depthImageWidth = sensorData.depthImageWidth;
                depthImageHeight = sensorData.depthImageHeight;

                // calculate the foreground rectangles
                Rect cameraRect = Camera.main.pixelRect;
                float rectHeight = cameraRect.height;
                float rectWidth = cameraRect.width;

                if (rectWidth > rectHeight)
                    rectWidth = rectHeight * depthImageWidth / depthImageHeight;
                else
                    rectHeight = rectWidth * depthImageHeight / depthImageWidth;

                float foregroundOfsX = (cameraRect.width - rectWidth) / 2;
                float foregroundOfsY = (cameraRect.height - rectHeight) / 2;
                foregroundImgRect = new Rect (foregroundOfsX, foregroundOfsY, rectWidth, rectHeight);
                foregroundGuiRect = new Rect (foregroundOfsX, cameraRect.height - foregroundOfsY, rectWidth, -rectHeight);
            }
        }
    }
开发者ID:AkihiroSato0309,项目名称:SoundRiderMiku_kinect,代码行数:31,代码来源:KinectSenserInitializer.cs


示例6: GestureDetector

    /// <summary>
    /// Initializes a new instance of the GestureDetector class along with the gesture frame source and reader
    /// </summary>
    /// <param name="kinectSensor">Active sensor to initialize the VisualGestureBuilderFrameSource object with</param>
    /// <param name="gestureResultView">GestureResultView object to store gesture results of a single body to</param>
    public GestureDetector(KinectSensor kinectSensor, KinectManager kinectManager)
    {
        if (kinectSensor == null)
        {
            throw new ArgumentNullException("kinectSensor");
        }

        // create the vgb source. The associated body tracking ID will be set when a valid body frame arrives from the sensor.
        this.vgbFrameSource = VisualGestureBuilderFrameSource.Create(kinectSensor, 0);
        this.vgbFrameSource.TrackingIdLost += this.Source_TrackingIdLost;

        // open the reader for the vgb frames
        this.vgbFrameReader = this.vgbFrameSource.OpenReader();
        if (this.vgbFrameReader != null)
        {
            this.vgbFrameReader.IsPaused = true;
            this.vgbFrameReader.FrameArrived += this.Reader_GestureFrameArrived;
        }

        // load the 'Seated' gesture from the gesture database
        using (VisualGestureBuilderDatabase database =  VisualGestureBuilderDatabase.Create(this.gestureDatabase))
        {
            // we could load all available gestures in the database with a call to vgbFrameSource.AddGestures(database.AvailableGestures), 
            // but for this program, we only want to track one discrete gesture from the database, so we'll load it by name
            foreach (Gesture gesture in database.AvailableGestures)
            {
                if (gesture.Name.Equals(this.shootingGestureName))
                {
                    this.vgbFrameSource.AddGesture(gesture);
                }
            }
        }
    }
开发者ID:oliverfei,项目名称:KinectShooting,代码行数:38,代码来源:GestureDetector.cs


示例7: Start

	void Start ()
	{
		// Make the rigid body not change rotation
		if (rigidbody)
			rigidbody.freezeRotation = true;
		
		rotationX = transform.localEulerAngles.y; 
		rotationY = transform.localEulerAngles.x;
		kinectManager = KinectManager.instance;
	}
开发者ID:Hoon-Park,项目名称:roche,代码行数:10,代码来源:MouseLook.cs


示例8: FixedUpdate

    // Update is called once per frame
    void FixedUpdate()
    {
        // show pause screen and return if isPaused
        if (isPaused)
        {
            overlay.waitingForPlayer.SetActive(false);
            overlay.pauseScreen.SetActive(true);
            begin = false;
            Cursor.visible = true;
            return;
        }
        else
            Cursor.visible = false;
        overlay.pauseScreen.SetActive(false);

        // setup kinect & return if no user found
        manager = KinectManager.Instance;
        long userID = manager ? manager.GetUserIdByIndex (0) : 0;
        if (userID == 0)
        {
            overlay.waitingForPlayer.SetActive(true);
            begin = false;
            return;
        }
        begin = true;
        overlay.waitingForPlayer.SetActive(false);

        // set joints
        bottomSpine = manager.GetJointPosition (userID, 0);
        bottomHead = manager.GetJointPosition (userID, 2);
        leftShoulder = manager.GetJointPosition (userID, 4);
        leftHand = manager.GetJointPosition (userID, 6);
        rightShoulder = manager.GetJointPosition (userID, 8);
        rightHand = manager.GetJointPosition (userID, 10);
        leftHip = manager.GetJointPosition (userID, 12);
        leftKnee = manager.GetJointPosition (userID, 13);
        leftFoot = manager.GetJointPosition (userID, 15);
        rightHip = manager.GetJointPosition (userID, 16);
        rightKnee = manager.GetJointPosition (userID, 17);
        rightFoot = manager.GetJointPosition (userID, 19);

        xBottom = bottomSpine.x;

        // Horizontal movement
        HorizontalMovement();

        // Forward movement
        MoveForward();

        // Calculate leg angles
        CalcAngles();

        // Calculate lowest foot
        LowestFoot();
    }
开发者ID:daanlevendig,项目名称:Kinect_Run_v2,代码行数:56,代码来源:Movement.cs


示例9: Program

 private Program()
 {
     Logger.Info("Start Application");
     var manager = new KinectManager();
     var left = new Kinect.Gestures.GrabAndThrow(HandToWatch.HandLeft);
     left.Detected += LeftOnDetected;
     manager.RegisterGesture(left);
     var right = new Kinect.Gestures.GrabAndThrow(HandToWatch.HandRight);
     right.Detected += RightOnDetected;
     manager.RegisterGesture(right);
 }
开发者ID:jansaris,项目名称:KinectV2,代码行数:11,代码来源:Program.cs


示例10: Awake

    private float speed; //vitesse du vaisseau

    #endregion Fields

    #region Methods

    void Awake()
    {
        j = 0;
        speed = Vaisseau.speedVaisseau;
        fast = false;

        // get needed objects´ references
        manager = GameObject.Find("Vaisseau/Main Camera").GetComponent<KinectManager>();

        infoGUI = GameObject.Find("HandGuiText");
    }
开发者ID:BabacarPlusPlus,项目名称:TER-2014,代码行数:17,代码来源:MouvementKinect.cs


示例11: VolumeTracker

 public VolumeTracker(float ulnaLength)
 {
     kinect = GameObject.Find("KinectManager").GetComponent<KinectManager>();
     transformMatrix = GameControl.Instance.TransformMatrix;
     volumes = new Volumes();
     offset = new Vector3(0.0f, -0.01f, 0.07f);
     if (ulnaLength > 0)
     {
         upperBound = ulnaLength / 100.0f;
         lowerBound = upperBound / 3.0f;
     }
 }
开发者ID:hazlett,项目名称:ChildrensHospital,代码行数:12,代码来源:VolumeTracker.cs


示例12: OnInitialize

        public override void OnInitialize()
        {
            manager = GetManager<KinectManager>();
            manager.AddGestureEvent(this);
            Stream gestureStream =
                typeof(GestureEvent).Assembly.GetManifestResourceStream(folder + GestureName + extention);

            //TODO null == gesture is if the file is not there.

            GestureDetector = new TemplatedGestureDetector(GestureName, gestureStream);
            GestureDetector.MinimalPeriodBetweenGestures = 0;
            GestureDetector.OnGestureDetected += detectedGesture;
        }
开发者ID:kinectitude,项目名称:kinectitude,代码行数:13,代码来源:GestureEvent.cs


示例13: Start

    // Use this for initialization
    IEnumerator Start()
    {
        FireballParticles.enableEmission = false;
        FireballCoreParticles.enableEmission = false;

        while (KManager == null && IManager == null)
        {
            KManager = KinectManager.Instance;
            IManager = InteractionManager.Instance;
        }

        yield return null;
    }
开发者ID:jsnulla,项目名称:Globe_Q3_CoC,代码行数:14,代码来源:Wizard.cs


示例14: slidersMinMaxChanged

    public void slidersMinMaxChanged()
    {
        if ( kinectManager == null )
        {
            GameObject go = GameObject.Find("goKinectManager");
            kinectManager = go.GetComponent<KinectManager>();
        }

        depthMinText.text = "MIN " + depthZMinSlider.value;
        depthMaxText.text = "MAX " + depthZMaxSlider.value;

        kinectManager.minDepth = depthZMinSlider.value;
        kinectManager.maxDepth = depthZMaxSlider.value;
    }
开发者ID:rickbarraza,项目名称:UnityKinectDepthExplorer,代码行数:14,代码来源:UIController.cs


示例15: Start

	void Start () 
	{
		kinectManager = KinectManager.Instance;
		faceTex = new Texture2D(100, 100, TextureFormat.ARGB32, false);

		if(targetObject)
		{
			targetRenderer = targetObject.GetComponent<Renderer>();

			if(targetRenderer && targetRenderer.material)
			{
				targetRenderer.material.SetTextureScale("_MainTex", new Vector2(1, -1));
			}
		}
	}
开发者ID:anteaterho,项目名称:SpoutTestTemp,代码行数:15,代码来源:SetFaceTexture.cs


示例16: Update

    // Update is called once per frame
    void Update()
    {
        // Get the KinectManager instance
        if(kinectManager == null)
        {
            kinectManager = KinectManager.Instance;
        }

        if( kinectManager.IsUserDetected() ) {
            UpdateArms();
            flagDisconection = false;
        } else {
            flagDisconection = true;
        }
    }
开发者ID:drfuzzyness,项目名称:WearHax-OlivMatt,代码行数:16,代码来源:KinectFistController.cs


示例17: Start

    void Start()
    {
		manager = KinectManager.Instance;

		if (manager != null)
        {
			depthWidth = manager.GetDepthImageWidth();
			depthHeight = manager.GetDepthImageHeight();
			
			colorWidth = manager.GetColorImageWidth();
			colorHeight = manager.GetColorImageHeight();
			
			CreateMesh(depthWidth / SampleSize, depthHeight / SampleSize);
        }
    }
开发者ID:EmMoi,项目名称:VELocomotion,代码行数:15,代码来源:PointCloudView.cs


示例18: Update

    void Update()
    {
        if(manager == null)
        {
            manager = KinectManager.Instance;
        }

        // get the users texture
        if(manager && manager.IsInitialized())
        {
            foregroundTex = manager.GetUsersLblTex();
        }

        if(manager.IsUserDetected())
        {
            uint userId = manager.GetPlayer1ID();

            // update colliders
            int numColliders = (int)KinectWrapper.NuiSkeletonPositionIndex.Count;

            for(int i = 0; i < numColliders; i++)
            {
                if(manager.IsJointTracked(userId, i))
                {
                    Vector3 posJoint = manager.GetRawSkeletonJointPos(userId, i);

                    if(posJoint != Vector3.zero)
                    {
                        // convert the joint 3d position to depth 2d coordinates
                        Vector2 posDepth = manager.GetDepthMapPosForJointPos(posJoint);

                        float scaledX = posDepth.x * foregroundRect.width / KinectWrapper.Constants.DepthImageWidth;
                        float scaledY = posDepth.y * -foregroundRect.height / KinectWrapper.Constants.DepthImageHeight;

                        float screenX = foregroundOfs.x + scaledX;
                        float screenY = Camera.main.pixelHeight - (foregroundOfs.y + scaledY);
                        float zDistance = posJoint.z - Camera.main.transform.position.z;

                        Vector3 posScreen = new Vector3(screenX, screenY, zDistance);
                        Vector3 posCollider = Camera.main.ScreenToWorldPoint(posScreen);

                        jointColliders[i].transform.position = posCollider;
                    }
                }
            }
        }
    }
开发者ID:PC-Yolger,项目名称:Tesis-de-Grado---Unity-and-Kinect,代码行数:47,代码来源:DepthImageViewer.cs


示例19: Start

	void Start () 
	{
		manager = KinectManager.Instance;

		if(manager && manager.IsInitialized())
		{
			KinectInterop.SensorData sensorData = manager.GetSensorData();

			if(sensorData != null && sensorData.sensorInterface != null && foregroundCamera != null)
			{
				// get depth image size
				depthImageWidth = sensorData.depthImageWidth;
				depthImageHeight = sensorData.depthImageHeight;

				// calculate the foreground rectangles
				Rect cameraRect = foregroundCamera.pixelRect;
				float rectHeight = cameraRect.height;
				float rectWidth = cameraRect.width;
				
				if(rectWidth > rectHeight)
					rectWidth = rectHeight * depthImageWidth / depthImageHeight;
				else
					rectHeight = rectWidth * depthImageHeight / depthImageWidth;
				
				float foregroundOfsX = (cameraRect.width - rectWidth) / 2;
				float foregroundOfsY = (cameraRect.height - rectHeight) / 2;
				foregroundImgRect = new Rect(foregroundOfsX, foregroundOfsY, rectWidth, rectHeight);
				foregroundGuiRect = new Rect(foregroundOfsX, cameraRect.height - foregroundOfsY, rectWidth, -rectHeight);
				
				// create joint colliders
				numColliders = sensorData.jointCount;
				jointColliders = new GameObject[numColliders];
				
				for(int i = 0; i < numColliders; i++)
				{
					string sColObjectName = ((KinectInterop.JointType)i).ToString() + "Collider";
					jointColliders[i] = new GameObject(sColObjectName);
					jointColliders[i].transform.parent = transform;
					
					SphereCollider collider = jointColliders[i].AddComponent<SphereCollider>();
					collider.radius = 0.2f;
				}
			}
		}

	}
开发者ID:anteaterho,项目名称:SpoutTestTemp,代码行数:46,代码来源:DepthImageViewer.cs


示例20: Awake

    protected virtual void Awake()
    {
        if (Instance != null)
        {
            Debug.Log("Error. There can be only one KinectManager.");
            Debug.Log("Kinect Manager #1", Instance.gameObject);
            Debug.Log("Kinect manager #2", this.gameObject);
        }
        else
        {
            Instance = this;
        }

        /*Transform KinectRepresentation = this.transform.Find("Kinect");
        if (KinectRepresentation != null)
        {
            foreach (Renderer renderer in this.transform.Find("Kinect").GetComponentsInChildren<Renderer>())
                renderer.enabled = false;
        }*/
    }
开发者ID:ctankep,项目名称:ViveEmuTemplate,代码行数:20,代码来源:KinectManager.cs



注:本文中的KinectManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# KinectSensor类代码示例发布时间:2022-05-24
下一篇:
C# KinectInterop类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap