Exemple #1
0
        private void ConvertUnityCameraToBabylon(Camera camera, GameObject gameObject, float progress, ref UnityMetaData metaData, ref List <BabylonExport.Entities.BabylonParticleSystem> particleSystems, ref List <UnityFlareSystem> lensFlares, ref string componentTags)
        {
            ExporterWindow.ReportProgress(progress, "Exporting camera: " + camera.name);

            BabylonUniversalCamera babylonCamera = new BabylonUniversalCamera
            {
                name     = camera.name,
                id       = GetID(camera.gameObject),
                fov      = camera.fieldOfView * (float)Math.PI / 180,
                minZ     = camera.nearClipPlane,
                maxZ     = camera.farClipPlane,
                parentId = GetParentID(camera.transform),
                position = camera.transform.localPosition.ToFloat()
            };

            metaData.type = "Camera";
            metaData.properties.Add("hdr", camera.hdr);
            metaData.properties.Add("clearFlags", camera.clearFlags.ToString());
            metaData.properties.Add("cullingMask", camera.cullingMask);
            metaData.properties.Add("stereoEnabled", camera.stereoEnabled);
            metaData.properties.Add("useOcclusionCulling", camera.useOcclusionCulling);
            babylonCamera.tags = componentTags;

            var target            = new Vector3(0, 0, 1);
            var transformedTarget = camera.transform.TransformDirection(target);

            babylonCamera.target = (camera.transform.position + transformedTarget).ToFloat();
            babylonCamera.isStereoscopicSideBySide = camera.stereoEnabled;
            if (camera.orthographic)
            {
                float size = camera.orthographicSize;
                babylonCamera.orthoTop    = size;
                babylonCamera.orthoBottom = -size;
                babylonCamera.orthoLeft   = -size;
                babylonCamera.orthoRight  = size;
                babylonCamera.mode        = 1;
            }
            else
            {
                babylonCamera.mode = 0;
            }

            babylonCamera.metadata = metaData;
            babylonScene.CamerasList.Add(babylonCamera);

            if (Camera.main == camera)
            {
                babylonScene.activeCameraID = babylonCamera.id;
                babylonScene.clearColor     = camera.backgroundColor.ToFloat();
            }

            // Animations
            ExportAnimations(camera.transform, babylonCamera);

            // Collisions
            if (exportationOptions.ExportCollisions)
            {
                babylonCamera.checkCollisions = true;
                babylonCamera.applyGravity    = (exportationOptions.Gravity.X == 0 && exportationOptions.Gravity.Y == 0 && exportationOptions.Gravity.Z == 0) ? false : true;
                babylonCamera.ellipsoid       = exportationOptions.CameraEllipsoid.ToFloat();
            }

            // Lens Flares
            ParseLensFlares(gameObject, babylonCamera.id, ref lensFlares);

            // Particles Systems
            ParseParticleSystems(gameObject, babylonCamera.id, ref particleSystems);
        }
Exemple #2
0
        private void ConvertUnityCameraToBabylon(Camera camera, GameObject gameObject, float progress, ref UnityMetaData metaData, ref List <UnityFlareSystem> lensFlares, ref string componentTags)
        {
            ExporterWindow.ReportProgress(progress, "Exporting camera: " + camera.name);

            BabylonUniversalCamera babylonCamera = new BabylonUniversalCamera
            {
                name     = camera.name,
                id       = GetID(camera.gameObject),
                fov      = camera.fieldOfView * (float)Math.PI / 180,
                minZ     = camera.nearClipPlane,
                maxZ     = camera.farClipPlane,
                parentId = GetParentID(camera.transform),
                position = camera.transform.localPosition.ToFloat()
            };

            if (camera.transform.parent != null)
            {
                babylonCamera.rotation    = new float[3];
                babylonCamera.rotation[0] = camera.transform.localRotation.eulerAngles.x * (float)Math.PI / 180;
                babylonCamera.rotation[1] = camera.transform.localRotation.eulerAngles.y * (float)Math.PI / 180;
                babylonCamera.rotation[2] = camera.transform.localRotation.eulerAngles.z * (float)Math.PI / 180;
            }
            else
            {
                var target            = new Vector3(0, 0, 1);
                var transformedTarget = camera.transform.TransformDirection(target);
                babylonCamera.target = (camera.transform.position + transformedTarget).ToFloat();
            }

            if (camera.orthographic)
            {
                babylonCamera.tags += " [ORTHOGRAPHIC]";
                babylonCamera.mode  = 1;
            }
            else
            {
                babylonCamera.mode = 0;
            }

            bool preventDefault  = false;
            bool virtualJoystick = false;

            bool   trackPosition = false;
            float  positionScale = 1.0f;
            string displayName   = "";

            int   horizontalRes        = 1280;
            int   verticalRes          = 800;
            float horizontalScreen     = 0.1497f;
            float verticalScreen       = 0.0935f;
            float screenCenter         = 0.0468f;
            float cameraBridge         = 0.005f;
            float eyeToScreen          = 0.0410f;
            float interpupillary       = 0.0640f;
            float lensSeparation       = 0.0635f;
            float lensCenterOffset     = 0.1520f;
            float postProcessScale     = 1.7146f;
            bool  compensateDistortion = true;

            float  ratio             = 1.0f;
            float  exposure          = 1.0f;
            float  gaussCoeff        = 0.3f;
            float  gaussMean         = 1.0f;
            float  gaussStandDev     = 0.8f;
            float  gaussMultiplier   = 4.0f;
            float  brightThreshold   = 0.8f;
            float  minimumLuminance  = 1.0f;
            float  maximumLuminance  = 1e20f;
            float  luminanceIncrease = 0.5f;
            float  luminanceDecrease = 0.5f;
            bool   stereoSideBySide  = false;
            int    cameraRigInput    = 0;
            float  cameraMoveSpeed   = 1.0f;
            float  cameraRotateSpeed = 0.005f;
            string cameraRigType     = "UniversalCamera";
            var    rigger            = gameObject.GetComponent <CameraRig>();

            if (rigger != null && rigger.isActiveAndEnabled)
            {
                cameraRigType                    = rigger.cameraType.ToString();
                cameraRigInput                   = (int)rigger.cameraInput;
                cameraMoveSpeed                  = rigger.inputMoveSpeed;
                cameraRotateSpeed                = rigger.inputRotateSpeed;
                babylonCamera.speed              = rigger.cameraSpeed;
                babylonCamera.inertia            = rigger.inertiaScaleFactor;
                babylonCamera.interaxialDistance = rigger.interaxialDistance;
                preventDefault                   = rigger.preventDefaultEvents;
                stereoSideBySide                 = rigger.stereoscopicSideBySide;
                virtualJoystick                  = (rigger.cameraType == BabylonCameraOptions.VirtualJoysticksCamera);

                trackPosition = rigger.virtualRealityWebPlatform.trackPosition;
                positionScale = rigger.virtualRealityWebPlatform.positionScale;
                displayName   = rigger.virtualRealityWebPlatform.displayName;;

                horizontalRes        = rigger.virtualRealityHeadsetOptions.horizontalResolution;
                verticalRes          = rigger.virtualRealityHeadsetOptions.verticalResolution;
                horizontalScreen     = rigger.virtualRealityHeadsetOptions.horizontalScreen;
                verticalScreen       = rigger.virtualRealityHeadsetOptions.verticalScreen;
                screenCenter         = rigger.virtualRealityHeadsetOptions.screenCenter;
                cameraBridge         = rigger.virtualRealityHeadsetOptions.cameraBridge;
                eyeToScreen          = rigger.virtualRealityHeadsetOptions.eyeToScreen;
                interpupillary       = rigger.virtualRealityHeadsetOptions.interpupillary;
                lensSeparation       = rigger.virtualRealityHeadsetOptions.lensSeparation;
                lensCenterOffset     = rigger.virtualRealityHeadsetOptions.lensCenterOffset;
                postProcessScale     = rigger.virtualRealityHeadsetOptions.postProcessScale;
                compensateDistortion = rigger.virtualRealityHeadsetOptions.compensateDistortion;

                ratio             = rigger.highDynamicRenderingPipeline.ratio;
                exposure          = rigger.highDynamicRenderingPipeline.exposure;
                gaussCoeff        = rigger.highDynamicRenderingPipeline.gaussCoeff;
                gaussMean         = rigger.highDynamicRenderingPipeline.gaussMean;
                gaussStandDev     = rigger.highDynamicRenderingPipeline.gaussStandDev;
                gaussMultiplier   = rigger.highDynamicRenderingPipeline.gaussMultiplier;
                brightThreshold   = rigger.highDynamicRenderingPipeline.brightThreshold;
                minimumLuminance  = rigger.highDynamicRenderingPipeline.minimumLuminance;
                maximumLuminance  = rigger.highDynamicRenderingPipeline.maximumLuminance;
                luminanceIncrease = rigger.highDynamicRenderingPipeline.luminanceIncrease;
                luminanceDecrease = rigger.highDynamicRenderingPipeline.luminanceDecrease;
            }
            SceneBuilder.Metadata.properties["virtualJoystickAttached"] = virtualJoystick;

            metaData.type = "Camera";
            metaData.properties.Add("cameraType", cameraRigType);
            metaData.properties.Add("cameraInput", cameraRigInput);
            metaData.properties.Add("clearFlags", camera.clearFlags.ToString());
            metaData.properties.Add("clearColor", camera.backgroundColor.ToFloat());
            metaData.properties.Add("cullingMask", camera.cullingMask);
            metaData.properties.Add("isOrthographic", camera.orthographic);
            metaData.properties.Add("orthographicSize", camera.orthographicSize);
            metaData.properties.Add("cameraMoveSpeed", cameraMoveSpeed);
            metaData.properties.Add("cameraRotateSpeed", cameraRotateSpeed);
            metaData.properties.Add("useOcclusionCulling", camera.useOcclusionCulling);
            metaData.properties.Add("preventDefaultEvents", preventDefault);
            metaData.properties.Add("stereoscopicSideBySide", stereoSideBySide);

            metaData.properties.Add("wvrTrackPosition", trackPosition);
            metaData.properties.Add("wvrPositionScale", positionScale);
            metaData.properties.Add("wvrDisplayName", displayName);

            metaData.properties.Add("vrHorizontalRes", horizontalRes);
            metaData.properties.Add("vrVerticalRes", verticalRes);
            metaData.properties.Add("vrHorizontalScreen", horizontalScreen);
            metaData.properties.Add("vrVerticalScreen", verticalScreen);
            metaData.properties.Add("vrScreenCenter", screenCenter);
            metaData.properties.Add("vrCameraBridge", cameraBridge);
            metaData.properties.Add("vrEyeToScreen", eyeToScreen);
            metaData.properties.Add("vrInterpupillary", interpupillary);
            metaData.properties.Add("vrLensSeparation", lensSeparation);
            metaData.properties.Add("vrLensCenterOffset", lensCenterOffset);
            metaData.properties.Add("vrPostProcessScale", postProcessScale);
            metaData.properties.Add("vrCompensateDistortion", compensateDistortion);

            metaData.properties.Add("hdr", camera.allowHDR);
            metaData.properties.Add("hdrPipeline", null);
            metaData.properties.Add("hdrRatio", ratio);
            metaData.properties.Add("hdrExposure", exposure);
            metaData.properties.Add("hdrGaussCoeff", gaussCoeff);
            metaData.properties.Add("hdrGaussMean", gaussMean);
            metaData.properties.Add("hdrGaussStandDev", gaussStandDev);
            metaData.properties.Add("hdrGaussMultiplier", gaussMultiplier);
            metaData.properties.Add("hdrBrightThreshold", brightThreshold);
            metaData.properties.Add("hdrMinimumLuminance", minimumLuminance);
            metaData.properties.Add("hdrMaximumLuminance", maximumLuminance);
            metaData.properties.Add("hdrLuminanceIncrease", luminanceIncrease);
            metaData.properties.Add("hdrLuminanceDecrease", luminanceDecrease);

            babylonCamera.isStereoscopicSideBySide = stereoSideBySide;
            babylonCamera.type = cameraRigType;
            babylonCamera.tags = componentTags;

            // Animations
            ExportTransformAnimationClips(camera.transform, babylonCamera, ref metaData);

            // Tagging
            if (!String.IsNullOrEmpty(babylonCamera.tags))
            {
                babylonCamera.tags = babylonCamera.tags.Trim();
            }

            babylonCamera.metadata = metaData;
            babylonScene.CamerasList.Add(babylonCamera);

            if (Camera.main == camera)
            {
                babylonScene.activeCameraID = babylonCamera.id;
                babylonScene.clearColor     = camera.backgroundColor.ToFloat();
            }

            // Collisions
            if (exportationOptions.ExportCollisions)
            {
                // TODO: Move To Camera Rig Options and Otherwise defaults
                babylonCamera.checkCollisions = true;
                if (SceneController != null)
                {
                    babylonCamera.applyGravity = (SceneController.sceneOptions.defaultGravity.y == 0.0f && SceneController.sceneOptions.defaultGravity.y == 0.0f && SceneController.sceneOptions.defaultGravity.z == 0.0f) ? false : true;
                    babylonCamera.ellipsoid    = SceneController.sceneOptions.defaultEllipsoid.ToFloat();
                }
            }

            // Lens Flares
            ParseLensFlares(gameObject, babylonCamera.id, ref lensFlares);

            // Particles Systems
            if (!exportationOptions.ExportMetadata)
            {
                babylonCamera.metadata = null;
            }
        }
        private void ConvertUnityCameraToBabylon(Camera camera, GameObject gameObject, float progress, ref UnityMetaData metaData, ref List <UnityFlareSystem> lensFlares, ref string componentTags)
        {
            ExporterWindow.ReportProgress(progress, "Exporting camera: " + camera.name);

            BabylonUniversalCamera babylonCamera = new BabylonUniversalCamera
            {
                name     = camera.name,
                id       = GetID(camera.gameObject),
                fov      = camera.fieldOfView * (float)Math.PI / 180,
                minZ     = camera.nearClipPlane,
                maxZ     = camera.farClipPlane,
                parentId = GetParentID(camera.transform),
                position = camera.transform.localPosition.ToFloat()
            };

            if (camera.transform.parent != null)
            {
                babylonCamera.rotation    = new float[3];
                babylonCamera.rotation[0] = camera.transform.localRotation.eulerAngles.x * (float)Math.PI / 180;
                babylonCamera.rotation[1] = camera.transform.localRotation.eulerAngles.y * (float)Math.PI / 180;
                babylonCamera.rotation[2] = camera.transform.localRotation.eulerAngles.z * (float)Math.PI / 180;
            }
            else
            {
                var target            = new Vector3(0, 0, 1);
                var transformedTarget = camera.transform.TransformDirection(target);
                babylonCamera.target = (camera.transform.position + transformedTarget).ToFloat();
            }

            if (camera.orthographic)
            {
                babylonCamera.tags += " [ORTHOGRAPHIC]";
                babylonCamera.mode  = 1;
            }
            else
            {
                babylonCamera.mode = 0;
            }

            bool preventDefault  = false;
            bool virtualJoystick = false;

            string followTarget             = null;
            float  followRadius             = 20.0f;
            float  followHeightOffset       = 4.0f;
            float  followRotationOffset     = 0.0f;
            float  followCameraAcceleration = 0.5f;
            float  followMaxCameraSpeed     = 50.0f;

            float arcRotateAlpha  = (float)Math.PI / 2.0f;
            float arcRotateBeta   = (float)Math.PI / 4.0f;
            float arcRotateRadius = 3.0f;

            float[] arcRotateTarget           = new float[] { 0.0f, 1.0f, 0.0f };
            float   arcRotateLowerRadiusLimit = 1;
            float   arcRotateUpperRadiusLimit = 10;

            float[] arcRotateCollisionRadius      = new float[] { 1.0f, 1.0f, 1.0f };
            float   arcRotateWheelDeltaPercentage = 0.01f;

            bool   enableVirtualReality    = false;
            bool   displayGazeIcon         = false;
            bool   displayLaserBeam        = true;
            bool   enableInteractions      = false;
            bool   enableTeleportation     = false;
            bool   useControllerPrefabs    = false;
            int    initialController       = 0;
            string leftControllerPrefab    = "LeftController";
            string rightControllerPrefab   = "RightController";
            bool   deviceOrientationCamera = false;
            bool   fallbackFreeCamera      = true;
            bool   useCustomButton         = false;
            string buttonElementID         = null;
            float  rayCastLength           = 100f;
            float  defaultHeight           = 1.7f;
            float  positionScale           = 1.0f;
            string floorMeshesTags         = "Navigation";

            bool   stereoSideBySide  = false;
            int    cameraRigInput    = 0;
            float  cameraMoveSpeed   = 1.0f;
            float  cameraRotateSpeed = 0.005f;
            string cameraRigType     = "UniversalCamera";
            bool   localMultiPlayer  = false;
            bool   cameraCollisions  = true;
            bool   useMovementKeys   = true;
            bool   applyCamerGravity = true;
            var    rigger            = gameObject.GetComponent <CameraRig>();

            if (rigger != null && rigger.isActiveAndEnabled)
            {
                localMultiPlayer                 = (rigger.cameraType == BabylonCameraOptions.LocalMultiPlayerViewCamera);
                cameraRigType                    = (localMultiPlayer == true) ? "UniversalCamera" : rigger.cameraType.ToString();
                cameraRigInput                   = (int)rigger.cameraInput;
                cameraMoveSpeed                  = rigger.inputMoveSpeed;
                cameraRotateSpeed                = rigger.inputRotateSpeed;
                babylonCamera.speed              = rigger.cameraSpeed;
                babylonCamera.inertia            = rigger.inertiaScaleFactor;
                babylonCamera.interaxialDistance = rigger.interaxialDistance;
                preventDefault                   = rigger.preventDefaultEvents;
                stereoSideBySide                 = rigger.stereoSideBySide;
                virtualJoystick                  = (rigger.cameraType == BabylonCameraOptions.VirtualJoysticksCamera);
                cameraCollisions                 = rigger.checkCameraCollision;
                useMovementKeys                  = rigger.useMovementKeys;
                applyCamerGravity                = rigger.applyCameraGravity;

                if (rigger.followCameraOptions.target != null)
                {
                    followTarget = GetID(rigger.followCameraOptions.target);
                }
                followRadius             = rigger.followCameraOptions.radius;
                followHeightOffset       = rigger.followCameraOptions.heightOffset;
                followRotationOffset     = rigger.followCameraOptions.rotationOffset;
                followCameraAcceleration = rigger.followCameraOptions.cameraAcceleration;
                followMaxCameraSpeed     = rigger.followCameraOptions.maxCameraSpeed;

                arcRotateAlpha                = rigger.arcRotateCameraOptions.rotateAlpha;
                arcRotateBeta                 = rigger.arcRotateCameraOptions.rotateBeta;
                arcRotateRadius               = rigger.arcRotateCameraOptions.rotateRadius;
                arcRotateTarget               = rigger.arcRotateCameraOptions.rotateTarget.ToFloat();
                arcRotateLowerRadiusLimit     = rigger.arcRotateCameraOptions.lowerRadiusLimit;
                arcRotateUpperRadiusLimit     = rigger.arcRotateCameraOptions.upperRadiusLimit;
                arcRotateCollisionRadius      = rigger.arcRotateCameraOptions.collisionRadius.ToFloat();
                arcRotateWheelDeltaPercentage = rigger.arcRotateCameraOptions.wheelDeltaPercentage;

                enableVirtualReality    = rigger.virtualRealityWebPlatform.experienceHelper;
                displayGazeIcon         = rigger.virtualRealityWebPlatform.displayGazeIcon;
                displayLaserBeam        = rigger.virtualRealityWebPlatform.displayLaserBeam;
                enableInteractions      = rigger.virtualRealityWebPlatform.enableInteractions;
                enableTeleportation     = rigger.virtualRealityWebPlatform.enableTeleportation;
                useControllerPrefabs    = rigger.virtualRealityWebPlatform.customControllerPrefabs.enablePrefabs;
                initialController       = (int)rigger.virtualRealityWebPlatform.customControllerPrefabs.initialController;
                leftControllerPrefab    = rigger.virtualRealityWebPlatform.customControllerPrefabs.leftPrefabName;
                rightControllerPrefab   = rigger.virtualRealityWebPlatform.customControllerPrefabs.rightPrefabName;
                deviceOrientationCamera = (rigger.virtualRealityWebPlatform.experienceHelperOptions.defaultCamera == VirtualRealityCamera.DeviceOrientationCamera);
                fallbackFreeCamera      = rigger.virtualRealityWebPlatform.experienceHelperOptions.fallbackCamera;
                useCustomButton         = rigger.virtualRealityWebPlatform.experienceHelperOptions.useCustomButton;
                buttonElementID         = rigger.virtualRealityWebPlatform.experienceHelperOptions.buttonElementID;
                rayCastLength           = rigger.virtualRealityWebPlatform.experienceHelperOptions.rayCastLength;
                defaultHeight           = rigger.virtualRealityWebPlatform.experienceHelperOptions.defaultHeight;
                positionScale           = rigger.virtualRealityWebPlatform.experienceHelperOptions.positionScale;
                floorMeshesTags         = rigger.virtualRealityWebPlatform.experienceHelperOptions.floorMeshesTags;
            }
            SceneBuilder.Metadata.properties["virtualJoystickAttached"] = virtualJoystick;

            metaData.type = "Camera";
            metaData.properties.Add("mainCamera", (Camera.main == camera));
            metaData.properties.Add("cameraType", cameraRigType);
            metaData.properties.Add("cameraInput", cameraRigInput);
            metaData.properties.Add("clearFlags", camera.clearFlags.ToString());
            metaData.properties.Add("clearColor", babylonScene.clearColor);
            metaData.properties.Add("cullingMask", camera.cullingMask);
            metaData.properties.Add("movementKeys", useMovementKeys);
            metaData.properties.Add("isOrthographic", camera.orthographic);
            metaData.properties.Add("orthographicSize", camera.orthographicSize);
            metaData.properties.Add("cameraMoveSpeed", cameraMoveSpeed);
            metaData.properties.Add("cameraRotateSpeed", cameraRotateSpeed);
            metaData.properties.Add("useOcclusionCulling", camera.useOcclusionCulling);
            metaData.properties.Add("preventDefaultEvents", preventDefault);
            metaData.properties.Add("stereoscopicSideBySide", stereoSideBySide);
            metaData.properties.Add("localMultiPlayerViewCamera", localMultiPlayer);

            metaData.properties.Add("followTarget", followTarget);
            metaData.properties.Add("followRadius", followRadius);
            metaData.properties.Add("followHeightOffset", followHeightOffset);
            metaData.properties.Add("followRotationOffset", followRotationOffset);
            metaData.properties.Add("followCameraAcceleration", followCameraAcceleration);
            metaData.properties.Add("followMaxCameraSpeed", followMaxCameraSpeed);

            metaData.properties.Add("arcRotateAlpha", arcRotateAlpha);
            metaData.properties.Add("arcRotateBeta", arcRotateBeta);
            metaData.properties.Add("arcRotateRadius", arcRotateRadius);
            metaData.properties.Add("arcRotateTarget", arcRotateTarget);
            metaData.properties.Add("arcRotateLowerRadiusLimit", arcRotateLowerRadiusLimit);
            metaData.properties.Add("arcRotateUpperRadiusLimit", arcRotateUpperRadiusLimit);
            metaData.properties.Add("arcRotateCollisionRadius", arcRotateCollisionRadius);
            metaData.properties.Add("arcRotateWheelDeltaPercentage", arcRotateWheelDeltaPercentage);

            metaData.properties.Add("webvrUniversalCamera", enableVirtualReality);
            metaData.properties.Add("webvrDisplayGazeIcon", displayGazeIcon);
            metaData.properties.Add("webvrDisplayLaserBeam", displayLaserBeam);
            metaData.properties.Add("webvrEnableInteractions", enableInteractions);
            metaData.properties.Add("webvrEnableTeleportation", enableTeleportation);
            metaData.properties.Add("webvrControllerPrefabs", useControllerPrefabs);
            metaData.properties.Add("webvrInitialController", initialController);
            metaData.properties.Add("webvrLeftControllerPrefab", leftControllerPrefab);
            metaData.properties.Add("webvrRightControllerPrefab", rightControllerPrefab);
            metaData.properties.Add("webvrDeviceOrientationCamera", deviceOrientationCamera);
            metaData.properties.Add("webvrFallbackFreeCamera", fallbackFreeCamera);
            metaData.properties.Add("webvrUseCustomButton", useCustomButton);
            metaData.properties.Add("webvrButtonElementID", buttonElementID);
            metaData.properties.Add("webvrRayCastLength", rayCastLength);
            metaData.properties.Add("webvrDefaultHeight", defaultHeight);
            metaData.properties.Add("webvrPositionScale", positionScale);
            metaData.properties.Add("webvrFloorMeshesTags", floorMeshesTags);

            babylonCamera.isStereoscopicSideBySide = stereoSideBySide;
            babylonCamera.applyGravity             = applyCamerGravity;
            babylonCamera.type = cameraRigType;
            babylonCamera.tags = componentTags;

            // Animations
            ExportTransformAnimationClips(camera.transform, babylonCamera, ref metaData);

            // Tagging
            if (!String.IsNullOrEmpty(babylonCamera.tags))
            {
                babylonCamera.tags = babylonCamera.tags.Trim();
            }

            babylonCamera.metadata = metaData;
            babylonScene.CamerasList.Add(babylonCamera);

            if (Camera.main == camera)
            {
                babylonScene.activeCameraID = babylonCamera.id;
            }

            // Collisions
            if (exportationOptions.ExportCollisions)
            {
                if (camera.transform.parent != null)
                {
                    babylonCamera.checkCollisions = false;
                }
                else
                {
                    babylonCamera.checkCollisions = cameraCollisions;
                }
            }

            // Lens Flares
            ParseLensFlares(gameObject, babylonCamera.id, ref lensFlares);

            // Greavity Ellispoid
            if (SceneController != null)
            {
                babylonCamera.ellipsoid = SceneController.sceneOptions.defaultEllipsoid.ToFloat();
            }

            // Particles Systems
            if (!exportationOptions.ExportMetadata)
            {
                babylonCamera.metadata = null;
            }
        }