Exemplo n.º 1
0
    void Awake()
    {
        inputManager = FindObjectOfType(typeof(RUISInputManager)) as RUISInputManager;

        playerManager   = GetComponent <NIPlayerManager>();
        RUISKinect2Data = GetComponent <RUISKinect2Data>();

        if (!inputManager.enableKinect)
        {
            playerManager.enabled = false;
        }
        if (!inputManager.enableKinect2)
        {
            RUISKinect2Data.enabled = false;
        }

        if (coordinateSystem == null)
        {
            coordinateSystem = FindObjectOfType(typeof(RUISCoordinateSystem)) as RUISCoordinateSystem;
        }

        for (int x = 0; x < 3; x++)         // Kinect 1, Kinect 2, Custom Tracker
        {
            for (int i = 0; i < 6; i++)
            {
                skeletons [x, i] = new Skeleton();

                // HACK  for filtering Kinect 2 arm rotations
                if (x == kinect2SensorID)
                {
                    for (int k = 0; k < skeletons[x, i].filterRot.Length; ++k)
                    {
                        skeletons[x, i].filterRot[k] = new KalmanFilteredRotation();
                        skeletons[x, i].filterRot[k].skipIdenticalMeasurements = true;
                        skeletons[x, i].filterRot[k].rotationNoiseCovariance   = skeletons[x, i].rotationNoiseCovariance;
                        skeletons[x, i].previousRotation[k] = Quaternion.identity;
                    }
                }
            }
        }

        isNewKinect2Frame         = false;
        timeSinceLastKinect2Frame = 0;
    }
Exemplo n.º 2
0
    void Awake()
    {
		inputManager = FindObjectOfType(typeof(RUISInputManager)) as RUISInputManager;

		playerManager = GetComponent<NIPlayerManager>();
		RUISKinect2Data = GetComponent<RUISKinect2Data>();

		if (!inputManager.enableKinect) playerManager.enabled = false;
		if (!inputManager.enableKinect2) RUISKinect2Data.enabled = false;

        if (coordinateSystem == null)
        {
            coordinateSystem = FindObjectOfType(typeof(RUISCoordinateSystem)) as RUISCoordinateSystem;
        }

		for (int x = 0; x < 3; x++) // Kinect 1, Kinect 2, Custom Tracker
		{
			for (int i = 0; i < 6; i++) 
			{
				skeletons [x, i] = new Skeleton ();

				// HACK  for filtering Kinect 2 arm rotations
				if(x == kinect2SensorID)
				{
					for(int k = 0; k < skeletons[x, i].filterRot.Length; ++k)
					{
						skeletons[x, i].filterRot[k] = new KalmanFilteredRotation();
						skeletons[x, i].filterRot[k].skipIdenticalMeasurements = true;
						skeletons[x, i].filterRot[k].rotationNoiseCovariance = skeletons[x, i].rotationNoiseCovariance;
						skeletons[x, i].previousRotation[k] = Quaternion.identity;
					}
				}
			}
		}
		
		isNewKinect2Frame = false;
		timeSinceLastKinect2Frame = 0;
    }