public RUISKinectFloorDataCalibrationProcess(RUISCalibrationProcessSettings calibrationSettings) { this.calibrationPhaseObjects = calibrationSettings.calibrationPhaseObjects; this.calibrationResultPhaseObjects = calibrationSettings.calibrationResultPhaseObjects; this.deviceModelObjects = calibrationSettings.deviceModelObjects; this.depthViewObjects = calibrationSettings.depthViewObjects; this.iconObjects = calibrationSettings.iconObjects; 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.calibrationPhaseObjects) this.calibrationPhaseObjects.SetActive(true); if(this.calibrationResultPhaseObjects) this.calibrationResultPhaseObjects.SetActive(false); this.xmlFilename = calibrationSettings.xmlFilename; coordinateSystem = MonoBehaviour.FindObjectOfType(typeof(RUISCoordinateSystem)) as RUISCoordinateSystem; // kinectSelection = MonoBehaviour.FindObjectOfType(typeof(NIPlayerManagerCOMSelection)) as NIPlayerManagerCOMSelection; settingsManager = MonoBehaviour.FindObjectOfType(typeof(OpenNISettingsManager)) as OpenNISettingsManager; }
public RUISKinectFloorDataCalibrationProcess(RUISCalibrationProcessSettings calibrationSettings) { this.calibrationPhaseObjects = calibrationSettings.calibrationPhaseObjects; this.calibrationResultPhaseObjects = calibrationSettings.calibrationResultPhaseObjects; this.deviceModelObjects = calibrationSettings.deviceModelObjects; this.depthViewObjects = calibrationSettings.depthViewObjects; this.iconObjects = calibrationSettings.iconObjects; 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.calibrationPhaseObjects) { this.calibrationPhaseObjects.SetActive(true); } if (this.calibrationResultPhaseObjects) { this.calibrationResultPhaseObjects.SetActive(false); } this.xmlFilename = calibrationSettings.xmlFilename; coordinateSystem = MonoBehaviour.FindObjectOfType(typeof(RUISCoordinateSystem)) as RUISCoordinateSystem; // kinectSelection = MonoBehaviour.FindObjectOfType(typeof(NIPlayerManagerCOMSelection)) as NIPlayerManagerCOMSelection; settingsManager = MonoBehaviour.FindObjectOfType(typeof(OpenNISettingsManager)) as OpenNISettingsManager; }
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; }
void Awake() { Cursor.visible = true; // Incase cursor was hidden in previous scene // Check if calibration settings were chosen on previous scene ruisNGUIMenu = FindObjectOfType(typeof(RUISMenuNGUI)) as RUISMenuNGUI; if (ruisNGUIMenu != null) { if (ruisNGUIMenu.currentMenuState == RUISMenuNGUI.RUISMenuStates.calibration) { numberOfSamplesToTake = 50; samplesPerSecond = 5; switch (ruisNGUIMenu.calibrationDropDownSelection) { case "Kinect - Kinect2": firstDevice = RUISDevice.Kinect_1; secondDevice = RUISDevice.Kinect_2; break; case "Kinect - PSMove": firstDevice = RUISDevice.Kinect_1; secondDevice = RUISDevice.PS_Move; break; case "Kinect 2 - PSMove": firstDevice = RUISDevice.Kinect_2; secondDevice = RUISDevice.PS_Move; break; case "Kinect 2 - Oculus DK2": firstDevice = RUISDevice.Kinect_2; secondDevice = RUISDevice.Oculus_DK2; break; case "Kinect - Oculus DK2": firstDevice = RUISDevice.Kinect_1; secondDevice = RUISDevice.Oculus_DK2; break; case "PSMove - Oculus DK2": firstDevice = RUISDevice.PS_Move; secondDevice = RUISDevice.Oculus_DK2; break; case "Kinect floor data": firstDevice = RUISDevice.Kinect_1; secondDevice = RUISDevice.Kinect_1; break; case "Kinect 2 floor data": firstDevice = RUISDevice.Kinect_2; secondDevice = RUISDevice.Kinect_2; break; default: firstDevice = RUISDevice.Null; secondDevice = RUISDevice.Null; break; } } } // Init scene objects this.floorPlane = GameObject.Find("Floor"); this.calibrationPhaseObjects = GameObject.Find("CalibrationPhase"); this.calibrationResultPhaseObjects = GameObject.Find("ResultPhase"); this.depthViews = GameObject.Find("Depth views"); this.deviceModels = GameObject.Find("Device models"); this.icons = GameObject.Find("Icons"); upperText = GameObject.Find("Upper Text").GetComponent <GUIText>(); lowerText = GameObject.Find("Lower Text").GetComponent <GUIText>(); skeletonController = FindObjectOfType(typeof(RUISSkeletonController)) as RUISSkeletonController; coordinateSystem = FindObjectOfType(typeof(RUISCoordinateSystem)) as RUISCoordinateSystem; // Pass variables and objects to calibrationProcess calibrationProcessSettings = new RUISCalibrationProcessSettings(); calibrationProcessSettings.xmlFilename = xmlFilename; calibrationProcessSettings.numberOfSamplesToTake = numberOfSamplesToTake; calibrationProcessSettings.numberOfSamplesPerSecond = samplesPerSecond; calibrationProcessSettings.calibrationCubePrefab = this.sampleCube; calibrationProcessSettings.calibrationSpherePrefab = this.sampleSphere; calibrationProcessSettings.calibrationPhaseObjects = this.calibrationPhaseObjects; calibrationProcessSettings.calibrationResultPhaseObjects = this.calibrationResultPhaseObjects; calibrationProcessSettings.deviceModelObjects = deviceModels; calibrationProcessSettings.depthViewObjects = depthViews; calibrationProcessSettings.iconObjects = icons; }
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; }
// Quaternion kinect1PitchRotation = Quaternion.identity; public RUISPSMoveToOculusDK2CalibrationProcess(RUISCalibrationProcessSettings calibrationSettings) { this.inputDevice1 = RUISDevice.Oculus_DK2; this.inputDevice2 = RUISDevice.PS_Move; this.numberOfSamplesToTake = calibrationSettings.numberOfSamplesToTake; this.numberOfSamplesPerSecond = calibrationSettings.numberOfSamplesPerSecond; 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_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; this.PSMoveWandObject = GameObject.Find ("PSMoveWand"); this.mannequin = GameObject.Find ("Mannequin"); // Models this.psEyeModelObject = GameObject.Find ("PS Eye"); this.oculusDK2CameraObject = GameObject.Find ("OculusDK2Camera"); this.oculusRiftModel = GameObject.Find ("OculusRift"); // Icons this.psMoveIcon = GameObject.Find ("PS Move Icon"); this.oculusDK2Icon = GameObject.Find ("OculusDK2 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.mannequin) this.mannequin.SetActive(false); if(this.psEyeModelObject) this.psEyeModelObject.SetActive(true); if(this.PSMoveWandObject) this.PSMoveWandObject.SetActive(true); if(this.oculusRiftModel) this.oculusRiftModel.SetActive(true); if(this.oculusDK2CameraObject) this.oculusDK2CameraObject.SetActive(true); if(this.psMoveIcon) this.psMoveIcon.SetActive(true); if(this.oculusDK2Icon) this.oculusDK2Icon.SetActive(true); if(this.calibrationPhaseObjects) this.calibrationPhaseObjects.SetActive(true); if(this.calibrationResultPhaseObjects) this.calibrationResultPhaseObjects.SetActive(false); 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; }
public RUISKinect2ToPSMoveCalibrationProcess(RUISCalibrationProcessSettings calibrationSettings) { this.inputDevice1 = RUISDevice.Kinect_2; this.inputDevice2 = RUISDevice.PS_Move; 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); } psMoveWrapper = MonoBehaviour.FindObjectOfType(typeof(PSMoveWrapper)) as PSMoveWrapper; 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_PSMove = 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; this.PSMoveWandObject = GameObject.Find ("PSMoveWand"); // Models this.psEyeModelObject = GameObject.Find ("PS Eye"); this.kinect2ModelObject = GameObject.Find ("Kinect2Camera"); // Depth view this.depthView = GameObject.Find ("Kinect2DepthView"); // Icons this.psMoveIcon = GameObject.Find ("PS Move Icon"); this.KinectIcon = GameObject.Find ("Kinect2 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.kinect2ModelObject) this.kinect2ModelObject.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; }
void Awake () { Cursor.visible = true; // Incase cursor was hidden in previous scene // Check if calibration settings were chosen on previous scene ruisNGUIMenu = FindObjectOfType(typeof(RUISMenuNGUI)) as RUISMenuNGUI; if(ruisNGUIMenu != null) { if(ruisNGUIMenu.currentMenuState == RUISMenuNGUI.RUISMenuStates.calibration) { numberOfSamplesToTake = 50; samplesPerSecond = 5; switch(ruisNGUIMenu.calibrationDropDownSelection) { case "Kinect - Kinect2": firstDevice = RUISDevice.Kinect_1; secondDevice = RUISDevice.Kinect_2; break; case "Kinect - PSMove": firstDevice = RUISDevice.Kinect_1; secondDevice = RUISDevice.PS_Move; break; case "Kinect 2 - PSMove": firstDevice = RUISDevice.Kinect_2; secondDevice = RUISDevice.PS_Move; break; case "Kinect 2 - Oculus DK2": firstDevice = RUISDevice.Kinect_2; secondDevice = RUISDevice.Oculus_DK2; break; case "Kinect - Oculus DK2": firstDevice = RUISDevice.Kinect_1; secondDevice = RUISDevice.Oculus_DK2; break; case "PSMove - Oculus DK2": firstDevice = RUISDevice.PS_Move; secondDevice = RUISDevice.Oculus_DK2; break; case "Kinect floor data": firstDevice = RUISDevice.Kinect_1; secondDevice = RUISDevice.Kinect_1; break; case "Kinect 2 floor data": firstDevice = RUISDevice.Kinect_2; secondDevice = RUISDevice.Kinect_2; break; default: firstDevice = RUISDevice.Null; secondDevice = RUISDevice.Null; break; } } } // Init scene objects this.floorPlane = GameObject.Find ("Floor"); this.calibrationPhaseObjects = GameObject.Find("CalibrationPhase"); this.calibrationResultPhaseObjects = GameObject.Find("ResultPhase"); this.depthViews = GameObject.Find ("Depth views"); this.deviceModels = GameObject.Find ("Device models"); this.icons = GameObject.Find ("Icons"); upperText = GameObject.Find ("Upper Text").GetComponent<GUIText>(); lowerText = GameObject.Find ("Lower Text").GetComponent<GUIText>(); skeletonController = FindObjectOfType(typeof(RUISSkeletonController)) as RUISSkeletonController; coordinateSystem = FindObjectOfType(typeof(RUISCoordinateSystem)) as RUISCoordinateSystem; // Pass variables and objects to calibrationProcess calibrationProcessSettings = new RUISCalibrationProcessSettings(); calibrationProcessSettings.xmlFilename = xmlFilename; calibrationProcessSettings.numberOfSamplesToTake = numberOfSamplesToTake; calibrationProcessSettings.numberOfSamplesPerSecond = samplesPerSecond; calibrationProcessSettings.calibrationCubePrefab = this.sampleCube; calibrationProcessSettings.calibrationSpherePrefab = this.sampleSphere; calibrationProcessSettings.calibrationPhaseObjects = this.calibrationPhaseObjects; calibrationProcessSettings.calibrationResultPhaseObjects = this.calibrationResultPhaseObjects; calibrationProcessSettings.deviceModelObjects = deviceModels; calibrationProcessSettings.depthViewObjects = depthViews; calibrationProcessSettings.iconObjects = icons; }
public RUISKinect2ToPSMoveCalibrationProcess(RUISCalibrationProcessSettings calibrationSettings) { this.inputDevice1 = RUISDevice.Kinect_2; this.inputDevice2 = RUISDevice.PS_Move; 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); } psMoveWrapper = MonoBehaviour.FindObjectOfType(typeof(PSMoveWrapper)) as PSMoveWrapper; 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_PSMove = 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; this.PSMoveWandObject = GameObject.Find ("PSMoveWand"); // Models this.psEyeModelObject = GameObject.Find ("PS Eye"); this.kinect2ModelObject = GameObject.Find ("Kinect2Camera"); // Depth view this.depthView = GameObject.Find ("Kinect2DepthView"); // Icons this.psMoveIcon = GameObject.Find ("PS Move Icon"); this.KinectIcon = GameObject.Find ("Kinect2 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.kinect2ModelObject) this.kinect2ModelObject.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; }
// Quaternion kinect1PitchRotation = Quaternion.identity; public RUISPSMoveToOculusDK2CalibrationProcess(RUISCalibrationProcessSettings calibrationSettings) { this.inputDevice1 = RUISDevice.Oculus_DK2; this.inputDevice2 = RUISDevice.PS_Move; this.numberOfSamplesToTake = calibrationSettings.numberOfSamplesToTake; this.numberOfSamplesPerSecond = calibrationSettings.numberOfSamplesPerSecond; 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_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; this.PSMoveWandObject = GameObject.Find("PSMoveWand"); this.mannequin = GameObject.Find("Mannequin"); // Models this.psEyeModelObject = GameObject.Find("PS Eye"); this.oculusDK2CameraObject = GameObject.Find("OculusDK2Camera"); this.oculusRiftModel = GameObject.Find("OculusRift"); // Icons this.psMoveIcon = GameObject.Find("PS Move Icon"); this.oculusDK2Icon = GameObject.Find("OculusDK2 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.mannequin) { this.mannequin.SetActive(false); } if (this.psEyeModelObject) { this.psEyeModelObject.SetActive(true); } if (this.PSMoveWandObject) { this.PSMoveWandObject.SetActive(true); } if (this.oculusRiftModel) { this.oculusRiftModel.SetActive(true); } if (this.oculusDK2CameraObject) { this.oculusDK2CameraObject.SetActive(true); } if (this.psMoveIcon) { this.psMoveIcon.SetActive(true); } if (this.oculusDK2Icon) { this.oculusDK2Icon.SetActive(true); } if (this.calibrationPhaseObjects) { this.calibrationPhaseObjects.SetActive(true); } if (this.calibrationResultPhaseObjects) { this.calibrationResultPhaseObjects.SetActive(false); } this.xmlFilename = calibrationSettings.xmlFilename; }