Ejemplo n.º 1
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            menuIsVisible = !menuIsVisible;
        }

        if (calibrationProcess != null)
        {
            upperText.text = calibrationProcess.guiTextUpper;
            lowerText.text = calibrationProcess.guiTextLower;
        }

        if (currentPhase != RUISCalibrationPhase.Invalid)
        {
            switch (currentPhase)
            {
            case RUISCalibrationPhase.Initial:
                currentPhase = calibrationProcess.InitialPhase(Time.deltaTime);
                break;

            case RUISCalibrationPhase.Preparation:
                currentPhase = calibrationProcess.PreparationPhase(Time.deltaTime);
                break;

            case RUISCalibrationPhase.ReadyToCalibrate:
                currentPhase = calibrationProcess.ReadyToCalibratePhase(Time.deltaTime);
                break;

            case RUISCalibrationPhase.Calibration:
                currentPhase = calibrationProcess.CalibrationPhase(Time.deltaTime);
                break;

            case RUISCalibrationPhase.ShowResults:
                currentPhase = calibrationProcess.ShowResultsPhase(Time.deltaTime);

                if (coordinateSystem)
                {
                    if (!coordinateSystem.applyToRootCoordinates)                            // Set values only once if applyToRootCoordinates == false
                    {
                        coordinateSystem.yawOffset      = RUISCalibrationProcessSettings.yawOffset;
                        coordinateSystem.positionOffset = RUISCalibrationProcessSettings.positionOffset;
                    }
                    coordinateSystem.applyToRootCoordinates = true;
                }

                calibrationProcess.PlaceSensorModels();

//					if(ruisNGUIMenu != null) {
//						ruisNGUIMenu.calibrationReady = true;
//						ruisNGUIMenu.menuIsVisible = true;
//					}
                break;
            }
        }
    }
Ejemplo n.º 2
0
    void Update()
    {
        if (calibrationProcess != null)
        {
            upperText.text = calibrationProcess.guiTextUpper;
            lowerText.text = calibrationProcess.guiTextLower;
        }

        if (currentPhase != RUISCalibrationPhase.Invalid)
        {
            switch (currentPhase)
            {
            case RUISCalibrationPhase.Initial:
                currentPhase = calibrationProcess.InitialPhase(Time.deltaTime);
                break;

            case RUISCalibrationPhase.Preparation:
                currentPhase = calibrationProcess.PreparationPhase(Time.deltaTime);
                break;

            case RUISCalibrationPhase.ReadyToCalibrate:
                currentPhase = calibrationProcess.ReadyToCalibratePhase(Time.deltaTime);
                break;

            case RUISCalibrationPhase.Calibration:
                currentPhase = calibrationProcess.CalibrationPhase(Time.deltaTime);
                break;

            case RUISCalibrationPhase.ShowResults:
                currentPhase = calibrationProcess.ShowResultsPhase(Time.deltaTime);
                if (ruisNGUIMenu != null)
                {
                    ruisNGUIMenu.calibrationReady = true;
                    ruisNGUIMenu.menuIsVisible    = true;
                }
                break;
            }
        }
    }
Ejemplo n.º 3
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 Update ()
	{
		if(calibrationProcess != null) {
			upperText.text = calibrationProcess.guiTextUpper;
			lowerText.text = calibrationProcess.guiTextLower;	
		}
	
		if(currentPhase != RUISCalibrationPhase.Invalid)
		{
			switch(currentPhase)
			{
				case RUISCalibrationPhase.Initial: 
					currentPhase = calibrationProcess.InitialPhase(Time.deltaTime);		
				break;
					
				case RUISCalibrationPhase.Preparation: 
					currentPhase = calibrationProcess.PreparationPhase(Time.deltaTime);		
				break;
					
				case RUISCalibrationPhase.ReadyToCalibrate: 
					currentPhase = calibrationProcess.ReadyToCalibratePhase(Time.deltaTime);		
				break;
					
				case RUISCalibrationPhase.Calibration: 
					currentPhase = calibrationProcess.CalibrationPhase(Time.deltaTime);		
				break;
				
				case RUISCalibrationPhase.ShowResults: 
					currentPhase = calibrationProcess.ShowResultsPhase(Time.deltaTime);	
					if(ruisNGUIMenu != null) {
						ruisNGUIMenu.calibrationReady = true;	
						ruisNGUIMenu.menuIsVisible = true;
					}
				break;
			}	
		}
	}
    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;
		
    	
    }