Пример #1
0
        void initialize()
        {
            if (mInitialized)
                return;

            if (ARCameraPrefab == null)
                throw new System.Exception("ARCameraPrefab has to be set in ARScene");



            mARCamera = (Instantiate(ARCameraPrefab.gameObject) as GameObject).GetComponent<ARCameraBehaviour>();
            mARCamera.name = "ARCamera(Global)";
            mARCamera.transform.parent = this.transform;
            mInitialized = true;
            ARScene.relocateBehaviour(this);
        }
Пример #2
0
        ARSceneBehaviour takeOverScene(ARSceneBehaviour previous)
        {
            //Ensure that the previous was initialized
            previous.initialize();


            //takeover the old ARCamera
            mARCamera = previous.mARCamera;
            mARCamera.transform.parent = this.transform;

            //Disable the old scene so nothing of it will get in our way
            previous.gameObject.SetActive(false);
            previous.clearDataSets();

            Destroy(previous.gameObject);
            //Set this to initialized, otheriwse the next takeover would start an initialization on this
            mInitialized = true;
            return this;
        }
        void Awake()
        {
            mCamera = this.GetComponent<Camera>();
            mCamera.enabled = false;
            mARCamera = ARScene.Behaviour.ARCameraBehaviour;

            if (ImprintOnGlobalCamera)
            {
                ARCamera.transform.position = transform.position;
                ARCamera.transform.rotation = transform.rotation;
            }

            transform.position = ARCamera.transform.position;
            transform.rotation = ARCamera.transform.rotation;


            if (AutoApplyLocalCullingMask)
            {
                applyLocalCullingMask(ARCamera.Camera);
            }
            mCachedCullingMask = Camera.cullingMask;
        }