Exemplo n.º 1
0
    protected override void DrawPlayerManager()
    {
        base.DrawPlayerManager();
        NIPlayerManagerCOMSelection manager = target as NIPlayerManagerCOMSelection;

        manager.m_maxAllowedDistance = EditorGUILayout.FloatField("Max distance", manager.m_maxAllowedDistance);
        if (manager.m_maxAllowedDistance < 0)
        {
            manager.m_maxAllowedDistance = 0;
        }
        manager.m_failurePenalty = EditorGUILayout.FloatField("Failure penalty", manager.m_failurePenalty);
        if (manager.m_failurePenalty < 0)
        {
            manager.m_failurePenalty = 0;
        }
        manager.m_minCOMChangeForFailure = EditorGUILayout.FloatField("Min change to retry", manager.m_minCOMChangeForFailure);
        if (manager.m_minCOMChangeForFailure < 0)
        {
            manager.m_minCOMChangeForFailure = 0;
        }
        manager.m_hysteresis = EditorGUILayout.FloatField("Hysteresis", manager.m_hysteresis);
        if (manager.m_hysteresis < 0)
        {
            manager.m_hysteresis = 0;
        }
    }
Exemplo n.º 2
0
    void Awake()
    {
        currentState    = State.Start;
        psMoveWrapper   = GetComponent <PSMoveWrapper>();
        kinectSelection = FindObjectOfType(typeof(NIPlayerManagerCOMSelection)) as NIPlayerManagerCOMSelection;
        statusText      = GetComponentInChildren <GUIText>();

        rawPSMoveSamples = new List <Vector3>();
        psMoveSamples    = new List <Vector3>();
        kinectSamples    = new List <Vector3>();

        Screen.SetResolution(resolutionX, resolutionY, Screen.fullScreen);
    }
    public RUISKinectToPSMoveCalibrationProcess(RUISCalibrationProcessSettings calibrationSettings)
    {
        this.inputDevice1 = RUISDevice.Kinect_1;
        this.inputDevice2 = RUISDevice.PS_Move;

        this.numberOfSamplesToTake    = calibrationSettings.numberOfSamplesToTake;
        this.numberOfSamplesPerSecond = calibrationSettings.numberOfSamplesPerSecond;


        kinectSelection  = MonoBehaviour.FindObjectOfType(typeof(NIPlayerManagerCOMSelection)) as NIPlayerManagerCOMSelection;
        settingsManager  = MonoBehaviour.FindObjectOfType(typeof(OpenNISettingsManager)) as OpenNISettingsManager;
        psMoveWrapper    = MonoBehaviour.FindObjectOfType(typeof(PSMoveWrapper)) as PSMoveWrapper;
        inputManager     = MonoBehaviour.FindObjectOfType(typeof(RUISInputManager)) as RUISInputManager;
        coordinateSystem = MonoBehaviour.FindObjectOfType(typeof(RUISCoordinateSystem)) as RUISCoordinateSystem;

        this.timeSinceScriptStart = 0;
        this.timeBetweenSamples   = 1 / (float)numberOfSamplesPerSecond;

        // Limit sample rate
        if (this.timeBetweenSamples < 0.1f)
        {
            this.timeBetweenSamples = 0.1f;
        }

        calibrationSpheres = new List <GameObject>();

        samples_PSMove = new List <Vector3>();
        samples_Kinect = new List <Vector3>();

        this.calibrationCube               = calibrationSettings.calibrationCubePrefab;
        this.calibrationSphere             = calibrationSettings.calibrationSpherePrefab;
        this.calibrationPhaseObjects       = calibrationSettings.calibrationPhaseObjects;
        this.calibrationResultPhaseObjects = calibrationSettings.calibrationResultPhaseObjects;

        this.deviceModelObjects = calibrationSettings.deviceModelObjects;
        this.depthViewObjects   = calibrationSettings.depthViewObjects;
        this.iconObjects        = calibrationSettings.iconObjects;

        this.PSMoveWandObject = GameObject.Find("PSMoveWand");

        // Models
        this.psEyeModelObject   = GameObject.Find("PS Eye");
        this.kinect1ModelObject = GameObject.Find("KinectCamera");

        // Depth view
        this.depthView = GameObject.Find("KinectDepthView");

        // Icons
        this.psMoveIcon = GameObject.Find("PS Move Icon");
        this.KinectIcon = GameObject.Find("Kinect Icon");

        this.floorPlane = GameObject.Find("Floor");

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

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

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

        if (this.psEyeModelObject)
        {
            this.psEyeModelObject.SetActive(true);
        }
        if (this.PSMoveWandObject)
        {
            this.PSMoveWandObject.SetActive(true);
        }
        if (this.kinect1ModelObject)
        {
            this.kinect1ModelObject.SetActive(true);
        }
        if (this.psMoveIcon)
        {
            this.psMoveIcon.SetActive(true);
        }
        if (this.KinectIcon)
        {
            this.KinectIcon.SetActive(true);
        }
        if (this.calibrationPhaseObjects)
        {
            this.calibrationPhaseObjects.SetActive(true);
        }
        if (this.calibrationResultPhaseObjects)
        {
            this.calibrationResultPhaseObjects.SetActive(false);
        }
        if (this.depthView)
        {
            this.depthView.SetActive(true);
        }
        this.xmlFilename = calibrationSettings.xmlFilename;
    }
Exemplo n.º 4
0
    public RUISKinectToOculusDK2CalibrationProcess(RUISCalibrationProcessSettings calibrationSettings)
    {
        this.inputDevice1 = RUISDevice.Oculus_DK2;
        this.inputDevice2 = RUISDevice.Kinect_1;

        this.numberOfSamplesToTake    = calibrationSettings.numberOfSamplesToTake;
        this.numberOfSamplesPerSecond = calibrationSettings.numberOfSamplesPerSecond;

        trackingIDs = new trackedBody[6];
        for (int y = 0; y < trackingIDs.Length; y++)
        {
            trackingIDs[y] = new trackedBody(-1, false, 1);
        }

        inputManager     = MonoBehaviour.FindObjectOfType(typeof(RUISInputManager)) as RUISInputManager;
        coordinateSystem = MonoBehaviour.FindObjectOfType(typeof(RUISCoordinateSystem)) as RUISCoordinateSystem;
        kinectSelection  = MonoBehaviour.FindObjectOfType(typeof(NIPlayerManagerCOMSelection)) as NIPlayerManagerCOMSelection;
        settingsManager  = MonoBehaviour.FindObjectOfType(typeof(OpenNISettingsManager)) as OpenNISettingsManager;

        this.timeSinceScriptStart = 0;
        this.timeBetweenSamples   = 1 / (float)numberOfSamplesPerSecond;

        // Limit sample rate
        if (this.timeBetweenSamples < 0.1f)
        {
            this.timeBetweenSamples = 0.1f;
        }

        calibrationSpheres = new List <GameObject>();

        samples_Kinect1   = new List <Vector3>();
        samples_OculusDK2 = new List <Vector3>();

        this.calibrationCube               = calibrationSettings.calibrationCubePrefab;
        this.calibrationSphere             = calibrationSettings.calibrationSpherePrefab;
        this.calibrationPhaseObjects       = calibrationSettings.calibrationPhaseObjects;
        this.calibrationResultPhaseObjects = calibrationSettings.calibrationResultPhaseObjects;

        this.deviceModelObjects = calibrationSettings.deviceModelObjects;
        this.depthViewObjects   = calibrationSettings.depthViewObjects;
        this.iconObjects        = calibrationSettings.iconObjects;


        if (GameObject.Find("PSMoveWand") != null)
        {
            GameObject.Find("PSMoveWand").SetActive(false);
        }

        // Models
        this.oculusDK2CameraObject = GameObject.Find("OculusDK2Camera");
        this.kinect1ModelObject    = GameObject.Find("KinectCamera");
        this.oculusRiftModel       = GameObject.Find("OculusRift");

        FixedFollowTransform followTransform = Component.FindObjectOfType <FixedFollowTransform>();

        if (followTransform && this.oculusRiftModel)
        {
            followTransform.transformToFollow = this.oculusRiftModel.transform;
        }

        // Depth view
        this.depthView = GameObject.Find("KinectDepthView");

        // Icons
        this.oculusDK2Icon = GameObject.Find("OculusDK2 Icon");
        this.kinectIcon    = GameObject.Find("Kinect Icon");

        this.floorPlane = GameObject.Find("Floor");

        if (this.oculusDK2Icon && this.oculusDK2Icon.GetComponent <GUITexture>())
        {
            this.oculusDK2Icon.GetComponent <GUITexture>().pixelInset = new Rect(5.1f, 10.0f, 70.0f, 70.0f);
        }

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

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

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

        if (this.oculusDK2CameraObject)
        {
            this.oculusDK2CameraObject.SetActive(true);
        }
        if (this.kinect1ModelObject)
        {
            this.kinect1ModelObject.SetActive(true);
        }
        if (this.oculusRiftModel)
        {
            this.oculusRiftModel.SetActive(true);
        }
        if (this.oculusDK2Icon)
        {
            this.oculusDK2Icon.SetActive(true);
        }
        if (this.kinectIcon)
        {
            this.kinectIcon.SetActive(true);
        }
        if (this.calibrationPhaseObjects)
        {
            this.calibrationPhaseObjects.SetActive(true);
        }
        if (this.calibrationResultPhaseObjects)
        {
            this.calibrationResultPhaseObjects.SetActive(false);
        }
        if (this.depthView)
        {
            this.depthView.SetActive(true);
        }
        this.xmlFilename = calibrationSettings.xmlFilename;
    }
	public RUISKinect2ToKinectCalibrationProcess(RUISCalibrationProcessSettings calibrationSettings) {
		
		this.inputDevice1 = RUISDevice.Kinect_2;
		this.inputDevice2 = RUISDevice.Kinect_1;
		
		this.numberOfSamplesToTake = calibrationSettings.numberOfSamplesToTake;
		this.numberOfSamplesPerSecond = calibrationSettings.numberOfSamplesPerSecond;
		
		trackingIDs = new trackedBody[6]; 
		for(int y = 0; y < trackingIDs.Length; y++) {
			trackingIDs[y] = new trackedBody(-1, false, 1);
		}
		
		kinectSelection = MonoBehaviour.FindObjectOfType(typeof(NIPlayerManagerCOMSelection)) as NIPlayerManagerCOMSelection;
		settingsManager = MonoBehaviour.FindObjectOfType(typeof(OpenNISettingsManager)) as OpenNISettingsManager;
		inputManager = MonoBehaviour.FindObjectOfType(typeof(RUISInputManager)) as RUISInputManager;
		coordinateSystem = MonoBehaviour.FindObjectOfType(typeof(RUISCoordinateSystem)) as RUISCoordinateSystem;
		kinect2SourceManager = MonoBehaviour.FindObjectOfType(typeof(Kinect2SourceManager)) as Kinect2SourceManager;
		
		this.timeSinceScriptStart = 0;
		this.timeBetweenSamples = 1 / (float)numberOfSamplesPerSecond;
		
		// Limit sample rate
		if(this.timeBetweenSamples < 0.1f) {
			this.timeBetweenSamples = 0.1f;
		}
		
		calibrationSpheres = new List<GameObject>();
		
		samples_Kinect1 = new List<Vector3>();
		samples_Kinect2 = new List<Vector3>();
		
		this.calibrationCube = calibrationSettings.calibrationCubePrefab;
		this.calibrationSphere = calibrationSettings.calibrationSpherePrefab;
		this.calibrationPhaseObjects = calibrationSettings.calibrationPhaseObjects;
		this.calibrationResultPhaseObjects = calibrationSettings.calibrationResultPhaseObjects;
		
		this.deviceModelObjects = calibrationSettings.deviceModelObjects;
		this.depthViewObjects = calibrationSettings.depthViewObjects;
		this.iconObjects = calibrationSettings.iconObjects;
		
		if(GameObject.Find ("PSMoveWand") != null)
			GameObject.Find ("PSMoveWand").SetActive(false);
		
		// Models
		this.kinect1ModelObject = GameObject.Find ("KinectCamera");
		this.kinect2ModelObject = GameObject.Find ("Kinect2Camera");
		
		RUISSkeletonController skeletonController = Component.FindObjectOfType<RUISSkeletonController>();
		Transform rightHand = null;
		if(skeletonController)
			rightHand = skeletonController.rightHand;
		FixedFollowTransform followTransform = Component.FindObjectOfType<FixedFollowTransform>();
		if(followTransform && rightHand)
			followTransform.transformToFollow = rightHand;
		
		// Depth view
		this.depthView = GameObject.Find ("KinectDepthView");
		this.depthView2 = GameObject.Find ("Kinect2DepthView");
		// Icons
		this.Kinect1Icon = GameObject.Find ("Kinect Icon");
		this.Kinect2Icon = GameObject.Find ("Kinect2 Icon");

		this.floorPlane = GameObject.Find ("Floor");

		if(this.Kinect1Icon && this.Kinect1Icon.GetComponent<GUITexture>())
			this.Kinect1Icon.GetComponent<GUITexture>().pixelInset = new Rect(5.1f, 10.0f, 70.0f, 70.0f);
		
		foreach (Transform child in this.deviceModelObjects.transform)
		{
			child.gameObject.SetActive(false);
		}
		
		foreach (Transform child in this.depthViewObjects.transform)
		{
			child.gameObject.SetActive(false);
		}
		
		foreach (Transform child in this.iconObjects.transform)
		{
			child.gameObject.SetActive(false);
		}
		
		if(this.kinect1ModelObject)
			this.kinect1ModelObject.SetActive(true);
		if(this.kinect2ModelObject)
			this.kinect2ModelObject.SetActive(true);
		if(this.Kinect1Icon)
			this.Kinect1Icon.SetActive(true);
		if(this.Kinect2Icon)
			this.Kinect2Icon.SetActive(true);
		if(this.calibrationPhaseObjects)
			this.calibrationPhaseObjects.SetActive(true);
		if(this.calibrationResultPhaseObjects)
			this.calibrationResultPhaseObjects.SetActive(false);
		if(this.depthView)
			this.depthView.SetActive(true);
		if(this.depthView2)
			this.depthView2.SetActive(true);
		this.xmlFilename = calibrationSettings.xmlFilename;
	}
	public RUISKinectToPSMoveCalibrationProcess(RUISCalibrationProcessSettings calibrationSettings) {
		
		
		this.inputDevice1 = RUISDevice.Kinect_1;
		this.inputDevice2 = RUISDevice.PS_Move;
		
		this.numberOfSamplesToTake = calibrationSettings.numberOfSamplesToTake;
		this.numberOfSamplesPerSecond = calibrationSettings.numberOfSamplesPerSecond;
		
		
		kinectSelection = MonoBehaviour.FindObjectOfType(typeof(NIPlayerManagerCOMSelection)) as NIPlayerManagerCOMSelection;
		settingsManager = MonoBehaviour.FindObjectOfType(typeof(OpenNISettingsManager)) as OpenNISettingsManager;
		psMoveWrapper = MonoBehaviour.FindObjectOfType(typeof(PSMoveWrapper)) as PSMoveWrapper;
		inputManager = MonoBehaviour.FindObjectOfType(typeof(RUISInputManager)) as RUISInputManager;
		coordinateSystem = MonoBehaviour.FindObjectOfType(typeof(RUISCoordinateSystem)) as RUISCoordinateSystem;
		
		this.timeSinceScriptStart = 0;
		this.timeBetweenSamples = 1 / (float)numberOfSamplesPerSecond;
		
		// Limit sample rate
		if(this.timeBetweenSamples < 0.1f) {
			this.timeBetweenSamples = 0.1f;
		}
		
		calibrationSpheres = new List<GameObject>();
		
		samples_PSMove = new List<Vector3>();
		samples_Kinect = new List<Vector3>();
		
		this.calibrationCube = calibrationSettings.calibrationCubePrefab;
		this.calibrationSphere = calibrationSettings.calibrationSpherePrefab;
		this.calibrationPhaseObjects = calibrationSettings.calibrationPhaseObjects;
		this.calibrationResultPhaseObjects = calibrationSettings.calibrationResultPhaseObjects;
		
		this.deviceModelObjects = calibrationSettings.deviceModelObjects;
		this.depthViewObjects = calibrationSettings.depthViewObjects;
		this.iconObjects = calibrationSettings.iconObjects;
		
		this.PSMoveWandObject = GameObject.Find ("PSMoveWand");
				
		// Models
		this.psEyeModelObject = GameObject.Find ("PS Eye");
		this.kinect1ModelObject = GameObject.Find ("KinectCamera");
		
		// Depth view
		this.depthView = GameObject.Find ("KinectDepthView");
		
		// Icons
		this.psMoveIcon = GameObject.Find ("PS Move Icon");
		this.KinectIcon = GameObject.Find ("Kinect Icon");
		
		this.floorPlane = GameObject.Find ("Floor");
		
		foreach (Transform child in this.deviceModelObjects.transform)
		{
			child.gameObject.SetActive(false);
		}
		
		foreach (Transform child in this.depthViewObjects.transform)
		{
			child.gameObject.SetActive(false);
		}
		
		foreach (Transform child in this.iconObjects.transform)
		{
			child.gameObject.SetActive(false);
		}
		
		if(this.psEyeModelObject)
			this.psEyeModelObject.SetActive(true);
		if(this.PSMoveWandObject)
			this.PSMoveWandObject.SetActive(true);
		if(this.kinect1ModelObject)
			this.kinect1ModelObject.SetActive(true);
		if(this.psMoveIcon)
			this.psMoveIcon.SetActive(true);
		if(this.KinectIcon)
			this.KinectIcon.SetActive(true);
		if(this.calibrationPhaseObjects)
			this.calibrationPhaseObjects.SetActive(true);
		if(this.calibrationResultPhaseObjects)
			this.calibrationResultPhaseObjects.SetActive(false);
		if(this.depthView)
			this.depthView.SetActive(true);
		this.xmlFilename = calibrationSettings.xmlFilename;
	}
Exemplo n.º 7
0
    void Awake()
    {
        currentState = State.Start;
        psMoveWrapper = GetComponent<PSMoveWrapper>();
        kinectSelection = FindObjectOfType(typeof(NIPlayerManagerCOMSelection)) as NIPlayerManagerCOMSelection;
        statusText = GetComponentInChildren<GUIText>();

        rawPSMoveSamples = new List<Vector3>();
        psMoveSamples = new List<Vector3>();
        kinectSamples = new List<Vector3>();

        Screen.SetResolution(resolutionX, resolutionY, Screen.fullScreen);
    }