Esempio n. 1
0
    // 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();
    }
Esempio n. 2
0
    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");
            }
        }
    }
Esempio n. 3
0
    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);
    }
Esempio n. 4
0
    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");
            }
        }
    }