Пример #1
0
    void Start()
    {
        if ((firstDevice == RUISDevice.Kinect_2 && secondDevice == RUISDevice.Oculus_DK2) ||
            (secondDevice == RUISDevice.Kinect_2 && firstDevice == RUISDevice.Oculus_DK2))
        {
            skeletonController.bodyTrackingDeviceID = RUISSkeletonManager.kinect2SensorID;
            coordinateSystem.rootDevice             = RUISDevice.Kinect_2;
            calibrationProcess = new RUISKinect2ToOculusDK2CalibrationProcess(calibrationProcessSettings);
        }
        else if ((firstDevice == RUISDevice.Kinect_1 && secondDevice == RUISDevice.Kinect_2) ||
                 (secondDevice == RUISDevice.Kinect_1 && firstDevice == RUISDevice.Kinect_2))
        {
            skeletonController.bodyTrackingDeviceID = RUISSkeletonManager.kinect1SensorID;
            coordinateSystem.rootDevice             = RUISDevice.Kinect_1;
            calibrationProcess = new RUISKinect2ToKinectCalibrationProcess(calibrationProcessSettings);
        }
        else if ((firstDevice == RUISDevice.Kinect_1 && secondDevice == RUISDevice.PS_Move) ||
                 (secondDevice == RUISDevice.Kinect_1 && firstDevice == RUISDevice.PS_Move))
        {
            skeletonController.bodyTrackingDeviceID = RUISSkeletonManager.kinect1SensorID;
            coordinateSystem.rootDevice             = RUISDevice.Kinect_1;
            calibrationProcess = new RUISKinectToPSMoveCalibrationProcess(calibrationProcessSettings);
        }
        else if ((firstDevice == RUISDevice.Kinect_2 && secondDevice == RUISDevice.PS_Move) ||
                 (secondDevice == RUISDevice.Kinect_2 && firstDevice == RUISDevice.PS_Move))
        {
            skeletonController.bodyTrackingDeviceID = RUISSkeletonManager.kinect2SensorID;
            coordinateSystem.rootDevice             = RUISDevice.Kinect_2;
            calibrationProcess = new RUISKinect2ToPSMoveCalibrationProcess(calibrationProcessSettings);
        }
        else if ((firstDevice == RUISDevice.PS_Move && secondDevice == RUISDevice.Oculus_DK2) ||
                 (secondDevice == RUISDevice.PS_Move && firstDevice == RUISDevice.Oculus_DK2))
        {
            skeletonController.bodyTrackingDeviceID = RUISSkeletonManager.customSensorID;
            coordinateSystem.rootDevice             = RUISDevice.Oculus_DK2;
            calibrationProcess = new RUISPSMoveToOculusDK2CalibrationProcess(calibrationProcessSettings);
        }
        else if ((firstDevice == RUISDevice.Kinect_1 && secondDevice == RUISDevice.Oculus_DK2) ||
                 (secondDevice == RUISDevice.Kinect_1 && firstDevice == RUISDevice.Oculus_DK2))
        {
            skeletonController.bodyTrackingDeviceID = RUISSkeletonManager.kinect1SensorID;
            coordinateSystem.rootDevice             = RUISDevice.Kinect_1;
            calibrationProcess = new RUISKinectToOculusDK2CalibrationProcess(calibrationProcessSettings);
        }
        else if (firstDevice == RUISDevice.Kinect_1 && secondDevice == RUISDevice.Kinect_1)
        {
            skeletonController.bodyTrackingDeviceID = RUISSkeletonManager.kinect1SensorID;
            coordinateSystem.rootDevice             = RUISDevice.Kinect_1;
            calibrationProcess = new RUISKinectFloorDataCalibrationProcess(calibrationProcessSettings);
        }
        else if (firstDevice == RUISDevice.Kinect_2 && secondDevice == RUISDevice.Kinect_2)
        {
            skeletonController.bodyTrackingDeviceID = RUISSkeletonManager.kinect2SensorID;
            coordinateSystem.rootDevice             = RUISDevice.Kinect_2;
            calibrationProcess = new RUISKinect2FloorDataCalibrationProcess(calibrationProcessSettings);
        }

        else
        {
            calibrationProcess = null;
        }

        if (calibrationProcess == null)
        {
            upperText.text = "";
            lowerText.text = "Selected calibration device combination\n not yet supported.";

            foreach (Transform child in this.deviceModels.transform)
            {
                child.gameObject.SetActive(false);
            }

            foreach (Transform child in this.depthViews.transform)
            {
                child.gameObject.SetActive(false);
            }

            foreach (Transform child in this.icons.transform)
            {
                child.gameObject.SetActive(false);
            }

            this.calibrationResultPhaseObjects.SetActive(false);
            currentPhase = RUISCalibrationPhase.Invalid;
        }
        else
        {
            currentPhase = RUISCalibrationPhase.Initial;
        }
        string devicePairName  = firstDevice.ToString() + "-" + secondDevice.ToString();
        string devicePairName2 = secondDevice.ToString() + "-" + firstDevice.ToString();

        coordinateSystem.RUISCalibrationResultsIn4x4Matrix[devicePairName]     = Matrix4x4.identity;
        coordinateSystem.RUISCalibrationResultsDistanceFromFloor[firstDevice]  = 0.0f;
        coordinateSystem.RUISCalibrationResultsFloorPitchRotation[firstDevice] = Quaternion.identity;

        coordinateSystem.RUISCalibrationResultsIn4x4Matrix[devicePairName2]     = Matrix4x4.identity;
        coordinateSystem.RUISCalibrationResultsDistanceFromFloor[secondDevice]  = 0.0f;
        coordinateSystem.RUISCalibrationResultsFloorPitchRotation[secondDevice] = Quaternion.identity;
    }
    void Start()
    {
		if(			(firstDevice == RUISDevice.Kinect_2  && secondDevice == RUISDevice.Oculus_DK2)
		  		 ||	(secondDevice == RUISDevice.Kinect_2 && firstDevice == RUISDevice.Oculus_DK2 )) 
		{
			skeletonController.bodyTrackingDeviceID = RUISSkeletonManager.kinect2SensorID;
			coordinateSystem.rootDevice = RUISDevice.Kinect_2;
			calibrationProcess = new RUISKinect2ToOculusDK2CalibrationProcess(calibrationProcessSettings);
		}
		else if(	(firstDevice == RUISDevice.Kinect_1  && secondDevice == RUISDevice.Kinect_2)
		   		 ||	(secondDevice == RUISDevice.Kinect_1 && firstDevice == RUISDevice.Kinect_2 )) 
		{
			skeletonController.bodyTrackingDeviceID = RUISSkeletonManager.kinect1SensorID;
			coordinateSystem.rootDevice = RUISDevice.Kinect_1;
			calibrationProcess = new RUISKinect2ToKinectCalibrationProcess(calibrationProcessSettings);
		}
		else if(	(firstDevice == RUISDevice.Kinect_1  && secondDevice == RUISDevice.PS_Move)
		  		 ||	(secondDevice == RUISDevice.Kinect_1 && firstDevice == RUISDevice.PS_Move )) 
		{
			skeletonController.bodyTrackingDeviceID = RUISSkeletonManager.kinect1SensorID;
			coordinateSystem.rootDevice = RUISDevice.Kinect_1;
			calibrationProcess = new RUISKinectToPSMoveCalibrationProcess(calibrationProcessSettings);
		}
		else if(	(firstDevice == RUISDevice.Kinect_2  && secondDevice == RUISDevice.PS_Move)
		       	 ||	(secondDevice == RUISDevice.Kinect_2 && firstDevice == RUISDevice.PS_Move )) 
		{
			skeletonController.bodyTrackingDeviceID = RUISSkeletonManager.kinect2SensorID;
			coordinateSystem.rootDevice = RUISDevice.Kinect_2;
			calibrationProcess = new RUISKinect2ToPSMoveCalibrationProcess(calibrationProcessSettings);
		}
		else if(	(firstDevice == RUISDevice.PS_Move  && secondDevice == RUISDevice.Oculus_DK2)
		        ||	(secondDevice == RUISDevice.PS_Move && firstDevice == RUISDevice.Oculus_DK2 )) 
		{
			skeletonController.bodyTrackingDeviceID = RUISSkeletonManager.customSensorID;
			coordinateSystem.rootDevice = RUISDevice.Oculus_DK2;
			calibrationProcess = new RUISPSMoveToOculusDK2CalibrationProcess(calibrationProcessSettings);
		}
		else if(	(firstDevice == RUISDevice.Kinect_1  && secondDevice == RUISDevice.Oculus_DK2)
		   		||	(secondDevice == RUISDevice.Kinect_1 && firstDevice == RUISDevice.Oculus_DK2 )) 
		{
			skeletonController.bodyTrackingDeviceID = RUISSkeletonManager.kinect1SensorID;
			coordinateSystem.rootDevice = RUISDevice.Kinect_1;
			calibrationProcess = new RUISKinectToOculusDK2CalibrationProcess(calibrationProcessSettings);
		}
		else if(firstDevice == RUISDevice.Kinect_1  && secondDevice == RUISDevice.Kinect_1 ) 
		{
			skeletonController.bodyTrackingDeviceID = RUISSkeletonManager.kinect1SensorID;
			coordinateSystem.rootDevice = RUISDevice.Kinect_1;
			calibrationProcess = new RUISKinectFloorDataCalibrationProcess(calibrationProcessSettings);
		}
		else if(firstDevice == RUISDevice.Kinect_2  && secondDevice == RUISDevice.Kinect_2 ) 
		{
			skeletonController.bodyTrackingDeviceID = RUISSkeletonManager.kinect2SensorID;
			coordinateSystem.rootDevice = RUISDevice.Kinect_2;
			calibrationProcess = new RUISKinect2FloorDataCalibrationProcess(calibrationProcessSettings);
		}
		
		else {
			calibrationProcess = null;
		}	
    
    	if(calibrationProcess == null) {
			upperText.text = "";
			lowerText.text = "Selected calibration device combination\n not yet supported.";
			
			foreach (Transform child in this.deviceModels.transform)
			{
				child.gameObject.SetActive(false);
			}
			
			foreach (Transform child in this.depthViews.transform)
			{
				child.gameObject.SetActive(false);
			}
			
			foreach (Transform child in this.icons.transform)
			{
				child.gameObject.SetActive(false);
			}
			
			this.calibrationResultPhaseObjects.SetActive(false);
			currentPhase = RUISCalibrationPhase.Invalid;
		}
		else {
			currentPhase = RUISCalibrationPhase.Initial;
		}
		string devicePairName = firstDevice.ToString() + "-" + secondDevice.ToString();
		string devicePairName2 = secondDevice.ToString() + "-" + firstDevice.ToString();
		
		coordinateSystem.RUISCalibrationResultsIn4x4Matrix[devicePairName] = Matrix4x4.identity;
		coordinateSystem.RUISCalibrationResultsDistanceFromFloor[firstDevice] = 0.0f;
		coordinateSystem.RUISCalibrationResultsFloorPitchRotation[firstDevice] = Quaternion.identity;
		
		coordinateSystem.RUISCalibrationResultsIn4x4Matrix[devicePairName2] = Matrix4x4.identity;
		coordinateSystem.RUISCalibrationResultsDistanceFromFloor[secondDevice] = 0.0f;
		coordinateSystem.RUISCalibrationResultsFloorPitchRotation[secondDevice] = Quaternion.identity;
		
    	
    }