Example #1
0
    private void Awake()
    {
        ensureGameObjectIntegrity(false);
        if (Application.isPlaying == false)
        {
            return;
        }

        AirXRServer.LoadOnce();

        disableCameras();
        AirXRCameraRigManager.managerOnCurrentScene.RegisterCameraRig(this);
        AirXRCameraRigManager.managerOnCurrentScene.eventDispatcher.MessageReceived += onAirXRMessageReceived;

        playerID = AXRServerPlugin.InvalidPlayerID;

        inputStream = new AirXRServerInputStream(this);

        if (_sendAudio)
        {
            _audioOutputRouter                  = headAnchor.gameObject.AddComponent <AirXRServerAudioOutputRouter>();
            _audioOutputRouter.input            = _audioInput;
            _audioOutputRouter.targetAudioMixer = _targetAudioMixer;
            _audioOutputRouter.exposedRendererIDParameterName = _exposedRendererIDParameterName;
            _audioOutputRouter.targetCameraRig = this;

            if (_audioInput == AirXRServerAudioOutputRouter.Input.AudioListener)
            {
                _audioOutputRouter.output = AirXRServerAudioOutputRouter.Output.All;

                _audioListener = headAnchor.gameObject.AddComponent <AudioListener>();
            }
            else
            {
                _audioOutputRouter.output = AirXRServerAudioOutputRouter.Output.One;
            }
        }

        if (_audioOutputRouter)
        {
            _audioOutputRouter.enabled = false;
        }
        //if (_audioListener) {
        //    _audioListener.enabled = false;
        //}

        _predictiveCameraRig = GetComponent <AirXRPredictiveCameraRig>();
        _cameraEventEmitter  = cameras[0].gameObject.AddComponent <CameraEventEmitter>();

        onAwake();
    }
Example #2
0
    private void Awake()
    {
        _predictiveCameraRig = FindObjectOfType <AirXRPredictiveCameraRig>();
        if (_predictiveCameraRig == null)
        {
            throw new UnityException("[MotionPredictionPlayback] ERROR: There must exist an instance of AirVRStereoCameraRig in children.");
        }

        settings = Resources.Load <AirXRServerSettings>("AirXRServerSettings");
        if (settings == null)
        {
            settings = ScriptableObject.CreateInstance <AirXRServerSettings>();
        }

        _sceneCamera     = GetComponentInChildren <MPPSceneCamera>();
        _playbackCamera  = GetComponentInChildren <MPPPlaybackCamera>();
        _uiOverlay       = GetComponentInChildren <MPPUIOverlay>();
        _renderPerfGraph = GetComponentInChildren <MPPRenderPerfGraph>();

        if (playbackModeStartedByEditor)
        {
            _imageCapture = new MPPImageCapture(this);

            _predictiveCameraRig.gameObject.SetActive(false);

            if (AirXRServer.isInstantiated)
            {
                throw new UnityException("[MotionPredictionPlayback] ERROR: MotionPredictionPlayback script must be executed before AirVRCameraRig. Please adjust script execution order in the project settings.");
            }

            if (FindObjectOfType <AudioListener>() == null)
            {
                _sceneCamera.gameObject.AddComponent <AudioListener>();
            }
        }
    }
Example #3
0
 private void Awake()
 {
     _cameraRig = FindObjectOfType <AirXRPredictiveCameraRig>();
 }
 public AirXRPredictedMotionProvider(AirXRPredictiveCameraRig owner, MPPLiveMotionDataProvider motionDataProvider)
 {
     _owner = owner;
     _motionDataProvider = motionDataProvider;
 }