Пример #1
0
    void Update()
    {
        checkKeyboardInput();

        bool ready = ConfigLoaded & _localSurfaceReceived & _remoteSurfaceReceived & _workspace.Connected;

        if (ready)
        {
            if (!Configured)
            { // space setup here
                Configured = true;
                _log.Show  = false;

                _bodiesListener.startListening(int.Parse(_properties.localSetupInfo.trackerBroadcastPort));

                GameObject localOrigin = new GameObject("LocalOrigin");
                localOrigin.transform.rotation = Quaternion.identity;
                localOrigin.transform.position = Vector3.zero;

                GameObject remoteOrigin = new GameObject("RemoteOrigin");
                remoteOrigin.transform.rotation = Quaternion.identity;
                remoteOrigin.transform.position = Vector3.zero;

                GameObject localScreenCenter = new GameObject("localScreenCenter");
                localScreenCenter.transform.position = _localSurface.Center;
                localScreenCenter.transform.rotation = _localSurface.Perpendicular;

                Vector3 BLp = _calculateRemoteProxy(_localSurface.SurfaceBottomLeft, localScreenCenter, _properties.negativeSpaceLength);
                Vector3 BRp = _calculateRemoteProxy(_localSurface.SurfaceBottomRight, localScreenCenter, _properties.negativeSpaceLength);
                Vector3 TRp = _calculateRemoteProxy(_localSurface.SurfaceTopRight, localScreenCenter, _properties.negativeSpaceLength);
                Vector3 TLp = _calculateRemoteProxy(_localSurface.SurfaceTopLeft, localScreenCenter, _properties.negativeSpaceLength);

                SurfaceRectangle remoteSurfaceProxy = new SurfaceRectangle(BLp, BRp, TLp, TRp);

                GameObject remoteScreenCenter = new GameObject("remoteScreenCenter");
                remoteScreenCenter.transform.position = _remoteSurface.Center;
                remoteScreenCenter.transform.rotation = _remoteSurface.Perpendicular;

                localOrigin.transform.parent          = localScreenCenter.transform;
                remoteOrigin.transform.parent         = remoteScreenCenter.transform;
                remoteScreenCenter.transform.position = localScreenCenter.transform.position;
                remoteScreenCenter.transform.rotation = Quaternion.LookRotation(-localScreenCenter.transform.forward, localScreenCenter.transform.up);

                remoteScreenCenter.transform.position = remoteSurfaceProxy.Center;

                _localSurface.CenterGameObject  = localScreenCenter;
                _remoteSurface.CenterGameObject = remoteScreenCenter;

                _localOrigin  = localOrigin;
                _remoteOrigin = remoteOrigin;

                _negativeSpace.create(location, _localSurface, remoteSurfaceProxy, _properties.negativeSpaceLength);

                centerCamera();

                _prespectiveProjection.init(_localSurface);
                _tcpKinectListener.init();
                _tracker.init();

                ScreenDisplay screenDisplay = GameObject.Find("ScreenDisplay").GetComponent <ScreenDisplay>();
                screenDisplay.screenCenter = localScreenCenter.transform;
                screenDisplay.init();
            }
            else
            {
                if (false & Input.GetKeyDown(KeyCode.Space))
                {
                    if (_prespectiveProjection.Running && _prespectiveProjection.Active)
                    {
                        _prespectiveProjection.Active = false;
                        centerCamera();
                    }
                    else if (_prespectiveProjection.Running && !_prespectiveProjection.Active)
                    {
                        _prespectiveProjection.Active = true;
                    }
                }
            }
        }
        else
        {
        }
    }
Пример #2
0
    void Update()
    {
        if (__localSurfaceReceived && __remoteSurfaceReceived)
        {
            if (!__everythingIsNiceAndWellConfigured)
            {
                Debug.Log("XXX  " + this.ToString() + ": Creating the negative world!!!!! XXX");

                GameObject localOrigin = new GameObject("LocalOrigin");
                localOrigin.transform.rotation = Quaternion.identity;
                localOrigin.transform.position = Vector3.zero;

                GameObject remoteOrigin = new GameObject("RemoteOrigin");
                remoteOrigin.transform.rotation = Quaternion.identity;
                remoteOrigin.transform.position = Vector3.zero;

                GameObject localScreenCenter = new GameObject("localScreenCenter");
                localScreenCenter.transform.position = _localSurface.Center;
                localScreenCenter.transform.rotation = _localSurface.Perpendicular;

                Vector3 BLp = _calculateRemoteProxy(_localSurface.SurfaceBottomLeft, localScreenCenter, properties.negativeSpaceLength);
                Vector3 BRp = _calculateRemoteProxy(_localSurface.SurfaceBottomRight, localScreenCenter, properties.negativeSpaceLength);
                Vector3 TRp = _calculateRemoteProxy(_localSurface.SurfaceTopRight, localScreenCenter, properties.negativeSpaceLength);
                Vector3 TLp = _calculateRemoteProxy(_localSurface.SurfaceTopLeft, localScreenCenter, properties.negativeSpaceLength);

                SurfaceRectangle remoteSurfaceProxy = new SurfaceRectangle(BLp, BRp, TLp, TRp);

                /*GameObject lbl = new GameObject("lbl");
                 * lbl.transform.position = _localSurface.SurfaceBottomLeft;
                 * lbl.transform.rotation = _localSurface.Perpendicular;
                 * GameObject lbr = new GameObject("lbr");
                 * lbr.transform.position = _localSurface.SurfaceBottomRight;
                 * lbr.transform.rotation = _localSurface.Perpendicular;
                 * GameObject ltr = new GameObject("ltr");
                 * ltr.transform.position = _localSurface.SurfaceTopRight;
                 * ltr.transform.rotation = _localSurface.Perpendicular;
                 * GameObject rbl = new GameObject("rbl");
                 * rbl.transform.position = _remoteSurface.SurfaceBottomLeft;
                 * rbl.transform.rotation = _remoteSurface.Perpendicular;
                 * GameObject rbr = new GameObject("rbr");
                 * rbr.transform.position = _remoteSurface.SurfaceBottomRight;
                 * rbr.transform.rotation = _remoteSurface.Perpendicular;
                 * GameObject rtr = new GameObject("rtr");
                 * rtr.transform.position = _remoteSurface.SurfaceTopRight;
                 * rtr.transform.rotation = _remoteSurface.Perpendicular;
                 */

                GameObject remoteScreenCenter = new GameObject("remoteScreenCenter");
                remoteScreenCenter.transform.position = _remoteSurface.Center;
                remoteScreenCenter.transform.rotation = _remoteSurface.Perpendicular;

                localOrigin.transform.parent          = localScreenCenter.transform;
                remoteOrigin.transform.parent         = remoteScreenCenter.transform;
                remoteScreenCenter.transform.position = localScreenCenter.transform.position;
                remoteScreenCenter.transform.rotation = Quaternion.LookRotation(-localScreenCenter.transform.forward, localScreenCenter.transform.up);

                remoteScreenCenter.transform.position = remoteSurfaceProxy.Center;

                _localSurface.CenterGameObject  = localScreenCenter;
                _remoteSurface.CenterGameObject = remoteScreenCenter;

                _localOrigin  = localOrigin;
                _remoteOrigin = remoteOrigin;

                Transform mist = GameObject.Find("mist").transform;
                mist.position = new Vector3(0, _remoteOrigin.transform.position.y - mist.localScale.x, 0);

                foreach (Sensor sensor in _localSurface.sensors)
                {
                    GameObject g = new GameObject(sensor.id);
                    g.transform.parent        = _localOrigin.transform;
                    g.transform.localPosition = sensor.position;
                    g.transform.localRotation = sensor.rotation;
                }

                foreach (Sensor sensor in _remoteSurface.sensors)
                {
                    GameObject g = new GameObject(sensor.id);
                    g.transform.parent        = _remoteOrigin.transform;
                    g.transform.localPosition = sensor.position;
                    g.transform.localRotation = sensor.rotation;
                }

                _negativeSpace.create(location, _localSurface, remoteSurfaceProxy, properties.negativeSpaceLength);

                _projection.init(_localSurface);

                GetComponent <TcpKinectListener>().Init();

                __everythingIsNiceAndWellConfigured = true;

                GameObject.Find("Checkerboard").GetComponent <Checkerboard>().Init();

                GameObject hideScreenGo = GameObject.Find("HideScreen");
                hideScreenGo.transform.position = localScreenCenter.transform.position;
                hideScreenGo.transform.rotation = localScreenCenter.transform.rotation;

                //GameObject.Find("Projector").GetComponent<SimpleProjector>().init(remoteScreenCenter.transform);
            }
        }
    }