当前位置: 首页>>代码示例>>C#>>正文


C# KinectManager类代码示例

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


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


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