public void loadConfig() { string config = Application.dataPath + "/" + configFile; condition = (ConditionType)Enum.Parse(enumType: typeof(ConditionType), value: ConfigProperties.load(config, "condition")); task = (TaskType)Enum.Parse(enumType: typeof(TaskType), value: ConfigProperties.load(config, "task")); }
public string getProperty(Location location, string property) { string val = "" + location.ToString() + "." + property; Debug.Log("[CONFIG] Retrieving property: " + val); return(ConfigProperties.load(configFilename, val)); }
private void _loadConfig() { string config = Application.dataPath + "/" + configFile; SessionTimeMinutes = int.Parse(ConfigProperties.load(config, "sessionTimeMinutes")); condition = (ConditionType)Enum.Parse(enumType: typeof(ConditionType), value: ConfigProperties.load(config, "condition")); taskType = (TaskType)Enum.Parse(enumType: typeof(TaskType), value: ConfigProperties.load(config, "task")); }
// Use this for initialization void Start() { Application.runInBackground = true; ConfigFile = Application.dataPath + "/config.txt"; ConfigProperties.save(ConfigFile, "last.run", DateTime.Now.ToString("yyyy-MM-dd-HH:mm:ss")); setupLocation = (SetupLocation)Enum.Parse(enumType: typeof(SetupLocation), value: ConfigProperties.load(ConfigFile, "setup.type")); if (setupLocation == SetupLocation.LEFT) { _localPrefix = "left"; _remotePrefix = "right"; } else { _localPrefix = "right"; _remotePrefix = "left"; } localTrackerListenPort = int.Parse(ConfigProperties.load(ConfigFile, _localPrefix + ".tracker.listen.port")); remoteTrackerListenPort = int.Parse(ConfigProperties.load(ConfigFile, _remotePrefix + ".tracker.listen.port")); localTrackerAddress = ConfigProperties.load(ConfigFile, _localPrefix + ".setup.address"); int localTrackerBroadcastPort = int.Parse(ConfigProperties.load(ConfigFile, _localPrefix + ".tracker.broadcast.port")); localTrackerSurfaceRequestPort = int.Parse(ConfigProperties.load(ConfigFile, _localPrefix + ".tracker.surface.request.port")); localTrackerSurfaceListenerPort = int.Parse(ConfigProperties.load(ConfigFile, _localPrefix + ".tracker.surface.listener.port")); int localAvatarListenPort = int.Parse(ConfigProperties.load(ConfigFile, _localPrefix + ".client.avatar.listen.port")); remoteTrackerAddress = ConfigProperties.load(ConfigFile, _remotePrefix + ".setup.address"); int remoteTrackerBroadcastPort = int.Parse(ConfigProperties.load(ConfigFile, _remotePrefix + ".tracker.broadcast.port")); remoteTrackerSurfaceRequestPort = int.Parse(ConfigProperties.load(ConfigFile, _remotePrefix + ".tracker.surface.request.port")); remoteTrackerSurfaceListenerPort = int.Parse(ConfigProperties.load(ConfigFile, _remotePrefix + ".tracker.surface.listener.port")); int remoteAvatarListenPort = int.Parse(ConfigProperties.load(ConfigFile, _remotePrefix + ".client.avatar.listen.port")); GetComponent <CreepyTrackerSurfaceRequestListener>().StartReceive(localTrackerSurfaceListenerPort, remoteTrackerSurfaceListenerPort); GameObject eyes = GameObject.Find("Eyes"); eyes.transform.position = _getPositionFromConfig(ConfigProperties.load(ConfigFile, _localPrefix + ".eyes.localPosition")); eyes.transform.rotation = _getRotationFromConfig(ConfigProperties.load(ConfigFile, _localPrefix + ".eyes.localRotation")); if (!devCalibration) { RB1.GetComponentInChildren <MeshRenderer>().enabled = false; RB2.GetComponentInChildren <MeshRenderer>().enabled = false; if (setupLocation == SetupLocation.LEFT) { RB4.GetComponentInChildren <MeshRenderer>().enabled = false; } else { RB3.GetComponentInChildren <MeshRenderer>().enabled = false; } } _sensors = new Dictionary <string, GameObject>(); _surfaceRequest(); }
private void Update() { Transform myRig = setupLocation == SetupLocation.LEFT ? RB1 : RB2; ARCameraRig.transform.position = myRig.position; ARCameraRig.transform.rotation = myRig.rotation; if (!_everythingIsConfigured && _localSurface != null && _remoteSurface != null) { calibrateOptiTrackAndCreepyTracker(); _everythingIsConfigured = true; if (devCalibration) { ravatarManagerTracker.Init( remoteTrackerListenPort, int.Parse(ConfigProperties.load(ConfigFile, _localPrefix + ".client.avatar.listen.port")), remoteCreepyTrackerOrigin ); } } if (Input.GetKeyDown(KeyCode.D)) { GameObject pivot = GameObject.Find("Delta"); if (pivot != null) { string p = _gameObjectPositionToString(pivot.transform.position); string r = _gameObjectRotationToString(pivot.transform.rotation); ConfigProperties.save(ConfigFile, _localPrefix + ".remoteCreepyTrackerDelta.position", p); ConfigProperties.save(ConfigFile, _localPrefix + ".remoteCreepyTrackerDelta.rotation", r); } else { Debug.LogError("NO PIVOT FOUND"); } } if (Input.GetKeyDown(KeyCode.E)) { GameObject eyes = GameObject.Find("Eyes"); if (eyes != null) { string p = _gameObjectPositionToString(eyes.transform.localPosition); string r = _gameObjectRotationToString(eyes.transform.localRotation); ConfigProperties.save(ConfigFile, _localPrefix + ".eyes.localPosition", p); ConfigProperties.save(ConfigFile, _localPrefix + ".eyes.localRotation", r); } else { Debug.LogError("NO EYES FOUND"); } } }
private void calibrateOptiTrackAndCreepyTracker() { _deploySensors(_localSurface.sensors, localCreepyTrackerOrigin); Vector3 locpos = _getPositionFromConfig(ConfigProperties.load(ConfigFile, _localPrefix + ".rigidBodyCalibration.transform.position")); Quaternion locrot = _getRotationFromConfig(ConfigProperties.load(ConfigFile, _localPrefix + ".rigidBodyCalibration.transform.rotation")); string locKinectName = ConfigProperties.load(ConfigFile, _localPrefix + ".trackedKinect.name"); _sensors[locKinectName].transform.parent = null; localCreepyTrackerOrigin.parent = _sensors[locKinectName].transform; _sensors[locKinectName].transform.position = locpos; _sensors[locKinectName].transform.rotation = locrot; // _sensors[locKinectName].transform.forward = -_sensors[locKinectName].transform.forward; localCreepyTrackerOrigin.parent = null; _sensors[locKinectName].transform.parent = localCreepyTrackerOrigin.transform; _deploySensors(_remoteSurface.sensors, remoteCreepyTrackerOrigin); Vector3 rempos = _getPositionFromConfig(ConfigProperties.load(ConfigFile, _remotePrefix + ".rigidBodyCalibration.transform.position")); Quaternion remrot = _getRotationFromConfig(ConfigProperties.load(ConfigFile, _remotePrefix + ".rigidBodyCalibration.transform.rotation")); string remKinectName = ConfigProperties.load(ConfigFile, _remotePrefix + ".trackedKinect.name"); _sensors[remKinectName].transform.parent = null; remoteCreepyTrackerOrigin.parent = _sensors[remKinectName].transform; _sensors[remKinectName].transform.position = rempos; _sensors[remKinectName].transform.rotation = remrot; // _sensors[remKinectName].transform.forward = -_sensors[remKinectName].transform.forward; remoteCreepyTrackerOrigin.parent = null; _sensors[remKinectName].transform.parent = remoteCreepyTrackerOrigin.transform; //Position to center the avatar Vector3 deltapos = _getPositionFromConfig(ConfigProperties.load(ConfigFile, _localPrefix + ".remoteCreepyTrackerDelta.position")); Quaternion deltarot = _getRotationFromConfig(ConfigProperties.load(ConfigFile, _localPrefix + ".remoteCreepyTrackerDelta.rotation")); remoteCreepyTrackerOrigin.localPosition += deltapos; remoteCreepyTrackerOrigin.localRotation *= deltarot; remoteCreepyTrackerPosition = remoteCreepyTrackerOrigin.position; remoteCreepyTrackerRotation = remoteCreepyTrackerOrigin.rotation; GameObject g = new GameObject("Delta"); hologramPivot = g.transform; hologramPivot.position = remoteCreepyTrackerOrigin.position; hologramPivot.rotation = remoteCreepyTrackerOrigin.rotation; remoteCreepyTrackerOrigin.parent = g.transform; remoteCreepyTrackerOrigin.localPosition = Vector3.zero; remoteCreepyTrackerOrigin.localRotation = Quaternion.identity; //hologramPivot.position = deltapos; //hologramPivot.rotation = deltarot; }
private void loadConfig() { Dictionary <string, string> config = ConfigProperties.load(configFile); _videosDir = config["videosDir"]; _colorStreamName = config["colorStreamName"]; _depthStreamName = config["depthStreamName"]; _normalStreamName = config["normalStreamName"]; _vidWidth = int.Parse(config["vidWidth"]); _vidHeight = int.Parse(config["vidHeight"]); _layerNum = int.Parse(config["numLayers"]); for (int i = 0; i < _layerNum; i++) { string s = ""; s = s + i; string calib = config[s]; string[] chunks = calib.Split(';'); Matrix4x4 mat = new Matrix4x4(new Vector4(float.Parse(chunks[0]), float.Parse(chunks[4]), float.Parse(chunks[8]), float.Parse(chunks[12])), new Vector4(float.Parse(chunks[1]), float.Parse(chunks[5]), float.Parse(chunks[9]), float.Parse(chunks[13])), new Vector4(float.Parse(chunks[2]), float.Parse(chunks[6]), float.Parse(chunks[10]), float.Parse(chunks[14])), new Vector4(float.Parse(chunks[3]), float.Parse(chunks[7]), float.Parse(chunks[11]), float.Parse(chunks[15]))); GameObject cloudobj = new GameObject(s); cloudobj.transform.SetParent(_papi.transform); cloudobj.transform.localPosition = new Vector3(mat[0, 3], mat[1, 3], mat[2, 3]); cloudobj.transform.localRotation = mat.rotation; cloudobj.transform.localScale = new Vector3(-1, 1, 1); cloudobj.AddComponent <PointCloudDepth>(); PointCloudDepth cloud = cloudobj.GetComponent <PointCloudDepth>(); //play from url string colorvideo = _videosDir + "\\" + s + _colorStreamName; //char[] sep = { '\\' }; //string[] folderName = _videosDir.Split(sep); //string colorvideo = "CloudData\\" + folderName[folderName.Length - 1] + "\\" + s + _colorStreamName; string depthvideo = _videosDir + "\\" + s + _depthStreamName; //string normalvideo = _videosDir + "\\" + s + _normalStreamName; cloud.initStructs((uint)i, colorvideo, depthvideo, cloudobj, this); _clouds.Add(s, cloud); } }
void Update() { if (!_everythingIsConfigured) { ravatarManagerTracker.Init( remoteTrackerListenPort, int.Parse(ConfigProperties.load(ConfigFile, _localPrefix + ".client.avatar.listen.port")), remoteOrigin ); _everythingIsConfigured = true; } //if (Input.GetKey(KeyCode.Space)) // { // ARCameraRig.position = LocalHumanHead.position; //} }
private void _loadConfig() { string filePath = Application.dataPath + "/" + TrackerProperties.Instance.configFilename; string port = ConfigProperties.load(filePath, "udp.listenport"); if (port != "") { TrackerProperties.Instance.listenPort = int.Parse(port); } port = ConfigProperties.load(filePath, "udp.trackerport"); if (port != "") { TrackerProperties.Instance.trackerPort = int.Parse(port); } resetListening(); }
void Awake() { Application.runInBackground = true; ConfigFile = Application.dataPath + "/config.txt"; ConfigProperties.save(ConfigFile, "last.run", DateTime.Now.ToString("yyyy-MM-dd-HH:mm:ss")); setupLocation = (SetupLocation)Enum.Parse(enumType: typeof(SetupLocation), value: ConfigProperties.load(ConfigFile, "setup.type")); if (setupLocation == SetupLocation.LEFT) { _localPrefix = "left"; _remotePrefix = "right"; } else { _localPrefix = "right"; _remotePrefix = "left"; } formation = (Formation)Enum.Parse(enumType: typeof(Formation), value: ConfigProperties.load(ConfigFile, "start.formation")); localTrackerListenPort = int.Parse(ConfigProperties.load(ConfigFile, _localPrefix + ".tracker.listen.port")); remoteTrackerListenPort = int.Parse(ConfigProperties.load(ConfigFile, _remotePrefix + ".tracker.listen.port")); localTrackerAddress = ConfigProperties.load(ConfigFile, _localPrefix + ".setup.address"); int localTrackerBroadcastPort = int.Parse(ConfigProperties.load(ConfigFile, _localPrefix + ".tracker.broadcast.port")); localTrackerSurfaceRequestPort = int.Parse(ConfigProperties.load(ConfigFile, _localPrefix + ".tracker.surface.request.port")); localTrackerSurfaceListenerPort = int.Parse(ConfigProperties.load(ConfigFile, _localPrefix + ".tracker.surface.listener.port")); int localAvatarListenPort = int.Parse(ConfigProperties.load(ConfigFile, _localPrefix + ".client.avatar.listen.port")); remoteTrackerAddress = ConfigProperties.load(ConfigFile, _remotePrefix + ".setup.address"); int remoteTrackerBroadcastPort = int.Parse(ConfigProperties.load(ConfigFile, _remotePrefix + ".tracker.broadcast.port")); remoteTrackerSurfaceRequestPort = int.Parse(ConfigProperties.load(ConfigFile, _remotePrefix + ".tracker.surface.request.port")); remoteTrackerSurfaceListenerPort = int.Parse(ConfigProperties.load(ConfigFile, _remotePrefix + ".tracker.surface.listener.port")); int remoteAvatarListenPort = int.Parse(ConfigProperties.load(ConfigFile, _remotePrefix + ".client.avatar.listen.port")); GetComponent <CreepyTrackerSurfaceRequestListener>().StartReceive(localTrackerSurfaceListenerPort, remoteTrackerSurfaceListenerPort); localUdpListener.startListening(localTrackerBroadcastPort); remoteUdpListener.startListening(remoteTrackerBroadcastPort); }
private void LoadSkeletonData() { Dictionary <string, string> config = ConfigProperties.load(configFile); if (_skeletonPlayerGO == null) { _skeletonPlayerGO = new GameObject("SkeletonPlayer"); _skeletonPlayerGO.transform.position = Vector3.zero; _skeletonPlayerGO.transform.rotation = Quaternion.identity; _skeletonPlayerGO.transform.localScale = Vector3.one; _skeletonPlayer = _skeletonPlayerGO.AddComponent <FileListener>(); } _skeletonFileName = ""; if (config.ContainsKey("skeletonFileName")) { _skeletonFileName = config["skeletonFileName"]; } _skeletonPlayer.Initialize(_skeletonFileName); Debug.Log("has skele" + _skeletonPlayer.HasSkeleton()); }
public void Start() { ConfigFile = Application.dataPath + "/config.txt"; // 1. Ler cenas do config (ex. portas udp...) // 2. iniciar componentes int localTrackerBroadcastPort = int.Parse(ConfigProperties.load(ConfigFile, "tracker.broadcast.port")); int localTrackerListenPort = int.Parse(ConfigProperties.load(ConfigFile, "tracker.listen.port")); int localAvatarListenPort = int.Parse(ConfigProperties.load(ConfigFile, "client.avatar.listen.port")); localUdpBodiesListener.startListening(localTrackerBroadcastPort); if (loadRavatar) { localRavatarManager.Init( localTrackerListenPort, localAvatarListenPort, localOrigin ); } }
void Start() { _mode = MoveMode.XZ; string ConfigFile = Application.dataPath + "/config.txt"; _myLocation = (SetupLocation)Enum.Parse(enumType: typeof(SetupLocation), value: ConfigProperties.load(ConfigFile, "setup.type")); }
public void Awake() { ConfigFile = Application.dataPath + "/config.txt"; LocalAddress = GetLocalIPAddress(); ServerAddress = ConfigProperties.load(ConfigFile, "optitrack.server.address"); }
private void Update() { UpdateRigidBodies(); if (!_everythingIsConfigured && _localSurface != null && _remoteSurface != null) { calibrateOptiTrackAndCreepyTracker(); ravatarManagerTracker.Init( remoteTrackerListenPort, int.Parse(ConfigProperties.load(ConfigFile, _localPrefix + ".client.avatar.listen.port")), remoteCreepyTrackerOrigin ); if (calibrated) { _configureWorkspace(); } _everythingIsConfigured = true; } if (_everythingIsConfigured && calibrated && gotClouds) { if (dynamicScale) { _adjustHologramSize(); } else { if (!baselineReady) { _baselineHologramStartingRotationAndScale(); } _baselineHologramPosition(); } } if (Input.GetKeyDown(KeyCode.D)) { GameObject pivot = GameObject.Find("Delta"); if (pivot != null) { string p = _gameObjectPositionToString(pivot.transform.position); string r = _gameObjectRotationToString(pivot.transform.rotation); ConfigProperties.save(ConfigFile, _localPrefix + ".remoteCreepyTrackerDelta.position", p); ConfigProperties.save(ConfigFile, _localPrefix + ".remoteCreepyTrackerDelta.rotation", r); } else { Debug.LogError("NO PIVOT FOUND"); } } if (Input.GetKeyDown(KeyCode.E)) { GameObject eyes = GameObject.Find("Eyes"); if (eyes != null) { string p = _gameObjectPositionToString(eyes.transform.localPosition); string r = _gameObjectRotationToString(eyes.transform.localRotation); ConfigProperties.save(ConfigFile, _localPrefix + ".eyes.localPosition", p); ConfigProperties.save(ConfigFile, _localPrefix + ".eyes.localRotation", r); } else { Debug.LogError("NO EYES FOUND"); } } }