private void DoTargetOrbit(CameraParams t) { if (showTargetOrbitParams) { EditorGUI.indentLevel++; t.orbit = Toggle("Orbit target", t.orbit); if (t.orbit) { EditorGUI.indentLevel++; t.desiredOrbitDistance = FloatField("Desired orbit distance", t.desiredOrbitDistance); t.orbitSpeed = FloatField("Speed", t.orbitSpeed); t.orbitSpeedDistance = FloatField("Speed (distance)", t.orbitSpeedDistance); t.orbitSensitivity = FloatField("Sensitivity", t.orbitSensitivity); //min/max y angles LabelField("Min/max y angles:"); BeginHorizontal(); t.minOrbitYAngle = FloatField(t.minOrbitYAngle); //MinMaxSlider(ref t.minOrbitYAngle, ref t.maxOrbitYAngle, -90, 90, GUILayout.MinWidth(64), GUILayout.MaxWidth(256)); t.maxOrbitYAngle = FloatField(t.maxOrbitYAngle); EndHorizontal(); if (t.minOrbitYAngle > t.maxOrbitYAngle) { t.minOrbitYAngle = t.maxOrbitYAngle; //stop min angle going above max angle } EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } }
public override bool RunScriptCommand() { bool result = false; AdventureDigimonInfo digimonInfo = ClassSingleton <AdventureSceneData> .Instance.GetDigimonInfo(this.charaId); if (digimonInfo != null) { CharacterParams component = digimonInfo.model.GetComponent <CharacterParams>(); InvocationEffectParams component2 = digimonInfo.skillEffectList[this.uniqueSkillIndex].GetComponent <InvocationEffectParams>(); LightColorChanger component3 = ClassSingleton <AdventureSceneData> .Instance.adventureLight.GetComponent <LightColorChanger>(); IEnumerator enumerator = component2.SkillInitialize(ClassSingleton <AdventureSceneData> .Instance.adventureCamera.camera3D, ClassSingleton <AdventureSceneData> .Instance.stage, component3); while (enumerator.MoveNext()) { } CameraParams component4 = digimonInfo.skillCameraAnimation[this.uniqueSkillIndex].GetComponent <CameraParams>(); string text = digimonInfo.skillEffectSeList[this.uniqueSkillIndex]; if (null != component && null != component2 && null != component4 && !string.IsNullOrEmpty(text)) { component.PlayAnimation(CharacterAnimationType.attacks, SkillType.Deathblow, this.uniqueSkillIndex, null, null); component2.transform.position = component.transform.position; component4.transform.position = component.transform.position; AppCoroutine.Start(component2.PlaySkillAnimation(component), new Action(this.OnFinishCommand), false); component4.currentTargetCamera = ClassSingleton <AdventureSceneData> .Instance.adventureCamera.camera3D; component4.PlayCameraAnimation(component, false, false); SoundMng.Instance().TryPlaySE("SE/" + text + "/sound", 0f, false, true, null, -1); base.SetContinueAnalyzeForAnimationWaitTime(this.isWaitFlag); result = true; } } return(result); }
public IEnumerator LoadCameraMotion(string cameraMotionId, Action <CameraParams, string> result = null) { BattleDebug.Log("--- カメラモーション単体ロード cameraMotionId[" + cameraMotionId + "] : 開始"); CameraParams cameraParams = null; if (this.cameraParamsObject.TryGetValue(cameraMotionId, out cameraParams)) { cameraParams = this.cameraParamsObject[cameraMotionId]; } else { GameObject cameraMotionPrefab = this.m_battleStateManager.serverControl.GetCameraMotionPrefab(cameraMotionId); GameObject cameraMotion = base.Instantiate <GameObject>(cameraMotionPrefab); this.cameraParamsObject.Add(cameraMotionId, cameraMotion.GetComponent <CameraParams>()); cameraParams = this.cameraParamsObject[cameraMotionId]; cameraParams.gameObject.name = cameraMotionId; yield return(null); cameraParams.transform.SetParent(this.battleStateData.cameraMotionRoot); cameraParams.currentTargetCamera = this.hierarchyData.cameraObject.camera3D; cameraParams.GetPostEffectController(this.hierarchyData.cameraObject.postEffect); cameraParams.gameObject.SetActive(false); } if (result != null) { result(cameraParams, cameraMotionId); } BattleDebug.Log("--- カメラモーション単体ロード cameraMotionId[" + cameraMotionId + "] : 完了"); yield break; }
public void ApplyTo(CameraParams cameraParams) { cameraParams.rotation.x = pitchAngle; Vector3 lookDir = cameraParams.Forward; cameraParams.position = cameraParams.LookAtFloorPoint + (-lookDir * distToLookAtPoint); cameraParams.fov = fov; }
void OnPreCull() { #if UNITY_EDITOR if (!Application.isPlaying) { return; } #endif _camera.ResetWorldToCameraMatrix(); _finalCenterMatrix = _camera.worldToCameraMatrix; if (_hasDispatchedValidCameraParams) { CameraParams cameraParams = new CameraParams(_cachedCamera); //Image retriever applies the values on it's own, but it might have applied them too early //We force a re-apply now that the cameras have correct projection matrices LeapImageRetriever.Instance.ApplyCameraProjectionValues(); if (OnValidCameraParams != null) { OnValidCameraParams(cameraParams); } _hasDispatchedValidCameraParams = true; } }
public void Initialize() { cameraParams = GetComponentInChildren <CameraParams>(); if (cameraParams == null) { Debug.LogError("There is no CameraParams component"); } }
public void InitCameraParams() { CamRatio.SetupCamera(this._camera, 0f); GameObject gameObject = GameObject.FindGameObjectWithTag("SpawnPoint"); CameraParams component = gameObject.GetComponent <CameraParams>(); this._camera.fieldOfView = component.cameraFov; this._cameraConfiner = SimpleConfiner.Create(component); }
public PlayerCommand(bool isRecord) { if (isRecord) { modelsState = new SceneModelState(); btnState = new SceneBtnState(); cameraParams = new CameraParams(); } }
public void PlayCameraMotionActionCharacter(string cameraKey, CharacterStateControl characters) { if (this.cameraParamsObject.ContainsKey(cameraKey)) { if (this.m_cameraMotion != null) { this.m_cameraMotion.StopCameraAnimation(); } this.m_cameraMotion = this.cameraParamsObject[cameraKey]; this.m_cameraMotion.PlayCameraAnimation(characters.CharacterParams, BoolExtension.Inverse(characters.isEnemy, this.hierarchyData.onInverseCamera), true); } }
private IEnumerator MoveCamera(CameraParams currentCamera) { this._currentTransition = 0f; while (currentCamera.isPlaying) { this._isMovingCamera = true; this.SetMoveCamera(currentCamera, this._currentTransition); yield return(null); } this._isMovingCamera = false; yield break; }
public void PlayCameraMotionAction(string cameraKey, Transform position, bool isClamp = true) { if (this.cameraParamsObject.ContainsKey(cameraKey)) { if (this.m_cameraMotion != null) { this.m_cameraMotion.StopCameraAnimation(); } this.m_cameraMotion = this.cameraParamsObject[cameraKey]; this.m_cameraMotion.PlayCameraAnimation(position, false, isClamp); } }
//string cameraParamsByte; //private Customer markData; //public Customer MarkData //{ // set // { // markData = value; // _id = markData._id; // nameText.text = markData.bookmarkName; // // DebugLog.DebugLogInfo(markData.btnState+" btnState:"+btnState); // // DebugLog.DebugLogInfo(" markData.cameraParams:"+markData.cameraParams); // // DebugLog.DebugLogInfo("markData.BookmarkPicture :"+markData.BookmarkPicture.Length); // //类对象反序列化 // btnState = (SceneBtnState)BookMarkManager.DeserializeObject<SceneBtnState>(markData.btnState); // modelState = (SceneModelState)BookMarkManager.DeserializeObject<SceneModelState>(markData.modelState); // cameraParams = (CameraParams)BookMarkManager.DeserializeObject<CameraParams>(markData.cameraParams); // ImageMark = markData.BookmarkPicture; // ShowUI(); // } //} //书签的构造函数 //public BookMark(string _id,string _name,byte[] _ImageMark,string _modelState,string _btnState,string _cameraParams) //{ // id = _id; // ImageMarkByte = _ImageMark; // modelStateByte = _modelState; // btnStateByte = _btnState; // cameraParamsByte = _cameraParams; //} public void SetMarkData(BookMarkInfo mark_data, bool pc_image) { markInfo = mark_data; id = markInfo.id; nameText.text = markInfo.bookmarkName; //类对象反序列化 btnState = (SceneBtnState)Vesal_DirFiles.Bytes2Object(markInfo.btnState); modelState = (SceneModelState)Vesal_DirFiles.Bytes2Object(markInfo.modelState); cameraParams = (CameraParams)Vesal_DirFiles.Bytes2Object(markInfo.cameraParams); ImageMarkByte = markInfo.bookmarkPicture; is_fix = (markInfo.type == "0") ?true:false; playRecord = new PlayerCommand(modelState, btnState, cameraParams); ShowUI(pc_image); }
public void Initialize() { target = cameraMainMenuTransform; cameraComponent.fieldOfView = target.fov; cameraComponent.backgroundColor = target.backgroundColor; transform.position = target.transform.position; transform.rotation = target.transform.rotation; startColor = target.backgroundColor; startFov = target.fov; startPos = target.transform.position; startQuat = target.transform.rotation; }
public void StartMoving(CameraParams to, System.Action _callback, bool towardsLevel = false) { target = to; callback = _callback; isInTransition = true; startColor = cameraComponent.backgroundColor; startFov = cameraComponent.fieldOfView; startQuat = transform.rotation; startPos = transform.position; toLevel = towardsLevel; StartCoroutine("MoveCamera"); }
private void DoCamUpdateFunction(CameraParams t) { if (showCamUpdateFunctionParams) { EditorGUI.indentLevel++; t.updateFunction = (CameraUpdateFunction)EnumPopup(new GUIContent("Camera update function", "The Unity function in which to calculate camera movement. The standard is LateUpdate, which occurs after every Update " + "in the current frame. If you experience juddery camera movement using LateUpdate, try using FixedUpdate - this often solves camera jitter problems " + "when following a target which is moved in FixedUpdate. Also, if your follow target uses a Rigidbody for movement, and you are experiencing " + "camera jitter, try enabling interpolation or extrapolation on its rigidbody component."), t.updateFunction); EditorGUI.indentLevel--; } }
public override void OnInspectorGUI() { cameraParams = (CameraParams)target; DoTabs(); Space(); DoDividerLine(1); Space(); switch (currentTabID) { case 0: DoCameraMode(cameraParams); break; case 1: DoTargetFollowing(cameraParams); break; case 2: DoTargetOrbit(cameraParams); break; case 3: DoTargetLook(cameraParams); break; case 4: DoOcclusionAvoidance(cameraParams); break; case 5: DoCollisionAvoidance(cameraParams); break; case 6: DoCamUpdateFunction(cameraParams); break; default: break; } EditorUtility.SetDirty(target); }
private void DoCamWhiskers(CameraParams t) { if (showCamWhiskerParams) { EditorGUI.indentLevel++; t.useCamWhiskers = Toggle("Use camera whiskers", t.useCamWhiskers); if (t.useCamWhiskers) { EditorGUI.indentLevel++; t.whiskerPushStrength = FloatField("Push strength", t.whiskerPushStrength); t.numWhiskers = IntField("Number of whiskers", t.numWhiskers); t.whiskerLength = FloatField("Whisker length", t.whiskerLength); t.whiskerSectorAngle = Slider("Whisker angle", t.whiskerSectorAngle, 0f, 360f); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } }
void OnPreCull() { #if UNITY_EDITOR if (!Application.isPlaying) { return; } #endif _camera.ResetWorldToCameraMatrix(); _finalCenterMatrix = _camera.worldToCameraMatrix; if (!_hasDispatchedValidCameraParams) { CameraParams cameraParams = new CameraParams(_cachedCamera); if (OnValidCameraParams != null) { OnValidCameraParams(cameraParams); } _hasDispatchedValidCameraParams = true; } }
private void DoTargetLook(CameraParams t) { if (showTargetLookParams) { EditorGUI.indentLevel++; t.lookOffset = FloatField("Look offset", t.lookOffset); t.interpolateTargetLookAt = Toggle("Interpolate", t.interpolateTargetLookAt); if (t.interpolateTargetLookAt) { EditorGUI.indentLevel++; t.targetLookAtLerpSpeed = FloatField("Look at speed", t.targetLookAtLerpSpeed); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } }
public static IConfineCamera Create(Component c) { if (!c) { return(null); } if (c is CameraParams) { CameraParams cameraParams = c as CameraParams; SimpleConfiner simpleConfiner = new SimpleConfiner(); simpleConfiner.rangeX = cameraParams.rangeX; simpleConfiner.rangeZ = cameraParams.rangeZ; simpleConfiner.rangeX1 = cameraParams.rangeX; simpleConfiner.rangeZ1 = cameraParams.rangeZ; simpleConfiner.rangeX2 = cameraParams.rangeX; simpleConfiner.rangeZ2.x = cameraParams.rangeZ.x - 5f; simpleConfiner.rangeZ2.y = cameraParams.rangeZ.y - 5f; return(simpleConfiner); } return(null); }
public void MoveImmediate(CameraParams to) { target = to; transform.position = to.transform.position; transform.rotation = to.transform.rotation; if (cameraComponent.fieldOfView != to.fov) { cameraComponent.fieldOfView = to.fov; } if (cameraComponent.backgroundColor != to.backgroundColor) { cameraComponent.backgroundColor = to.backgroundColor; } if (isInTransition) { isInTransition = false; } }
private void DoCameraMode(CameraParams t) { if (showCameraModeParams) { EditorGUI.indentLevel++; t.camMode = (CameraBehaviourMode)EnumPopup("Camera mode", t.camMode); if (t.camMode == CameraBehaviourMode.FollowAndOrbit) { EditorGUI.indentLevel++; t.orbitToFollowHoldTime = FloatField("Transition hold time", t.orbitToFollowHoldTime); //t.orbitToFollowTransitionSpeed = FloatField("Transition speed", t.orbitToFollowTransitionSpeed); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } }
public void MakeSwitchingAnimation(SwitchAnimType animType, CameraParams aimParams) { this.animType = animType; armPosition = aimParams.armPosition; armAngleRotation = Quaternion.Euler(aimParams.armRotation); cameraPosition = aimParams.cameraPosition; shouldAnimateCamRotation = (animType == SwitchAnimType.FP_TO_SZ || animType == SwitchAnimType.SZ_TO_SZ_DOWN) ? Options.Instance.shouldUseDefPoints : true; if (animType == SwitchAnimType.FP_TO_SZ) { mainCamera.SetActive(false); additionalCamera.SetActive(true); RestartAdditionalCamera(); } RecountRelativeAnimSpeed(); canAnimate = true; }
private void DoCollisionAvoidance(CameraParams t) { if (showCollisionAvoidanceParams) { EditorGUI.indentLevel++; t.avoidCollisionWithGeometry = Toggle("Avoid collisions", t.avoidCollisionWithGeometry); if (t.avoidCollisionWithGeometry) { EditorGUI.indentLevel++; //https://answers.unity.com/questions/42996/how-to-create-layermask-field-in-a-custom-editorwi.html //just doing t.whateverMask = MaskField("..", t.colliderLayerMask, InternalEditorUtility.layers) makes the actual mask value one up from whatever the inspector shows, for some reason LayerMask colliderLayers = MaskField("Colliders layer mask", InternalEditorUtility.LayerMaskToConcatenatedLayersMask(t.colliderLayerMask), InternalEditorUtility.layers); t.colliderLayerMask = InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(colliderLayers); t.collisionMaxDistClampRelaxTime = FloatField("Distance clamp relaxation time", t.collisionMaxDistClampRelaxTime); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } }
public void SetMarkData(string path) { StreamReader sr = null; try { sr = File.OpenText(path); } catch (Exception e) { } ma = sr.ReadToEnd(); //关闭流 sr.Close(); //销毁流 sr.Dispose(); //将数组链表容器返回 //StateData.Instance.isReturn = false; Debug.Log(ma); // string ma = StateData.Instance.StatePath[StateData.Instance.StatePath.Count - 1]; BookMarkInfo mark = JsonConvert.DeserializeObject <BookMarkInfo>(ma); // mark = book[book.Count - 1]; BookMarkInfo markInfo = mark; Debug.Log(markInfo.ToString()); //类对象反序列化 btnState = (SceneBtnState)Vesal_DirFiles.Bytes2Object(markInfo.btnState); modelState = (SceneModelState)Vesal_DirFiles.Bytes2Object(markInfo.modelState); cameraParams = (CameraParams)Vesal_DirFiles.Bytes2Object(markInfo.cameraParams); playRecord = new PlayerCommand(modelState, btnState, cameraParams); LoadBookMark(); }
void OnPreCull() { #if UNITY_EDITOR if (!Application.isPlaying) { return; } #endif _camera.ResetWorldToCameraMatrix(); _finalCenterMatrix = _camera.worldToCameraMatrix; if (!_hasDispatchedValidCameraParams) { CameraParams cameraParams = new CameraParams(_cachedCamera); //Image retriever applies the values on it's own, but it might have applied them too early //We force a re-apply now that the cameras have correct projection matrices LeapImageRetriever.Instance.ApplyCameraProjectionValues(); if(OnValidCameraParams != null) { OnValidCameraParams(cameraParams); } _hasDispatchedValidCameraParams = true; } }
private void DoOcclusionAvoidance(CameraParams t) { if (showOcclusionAvoidanceParams) { EditorGUI.indentLevel++; t.avoidFollowTargetOcclusion = Toggle("Avoid occlusion", t.avoidFollowTargetOcclusion); if (t.avoidFollowTargetOcclusion) { EditorGUI.indentLevel++; LayerMask occluderLayers = MaskField("Occluders layer mask", InternalEditorUtility.LayerMaskToConcatenatedLayersMask(t.occluderLayerMask), InternalEditorUtility.layers); t.occluderLayerMask = InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(occluderLayers); t.occlusionPullInSpeedHorizontal = FloatField("Pull-in speed horizontal", t.occlusionPullInSpeedHorizontal); t.occlusionPullInSpeedVertical = FloatField("Pull-in speed vertical", t.occlusionPullInSpeedVertical); t.occlusionFollowSpeedIncrease = FloatField("Increase follow speed", t.occlusionFollowSpeedIncrease); t.occlusionClipPanePadding = FloatField("Near clip pane padding", t.occlusionClipPanePadding); t.useTimeInOcclusionMultiplier = Toggle("Ease in/out multiplier", t.useTimeInOcclusionMultiplier); if (t.useTimeInOcclusionMultiplier) { EditorGUI.indentLevel++; t.maxTimeInOcclusionMultiplier = FloatField("Max", t.maxTimeInOcclusionMultiplier); t.timeInOcclusionRampUpSpeed = FloatField("Ease in speed", t.timeInOcclusionRampUpSpeed); t.timeInOcclusionRampDownSpeed = FloatField("Ease out speed", t.timeInOcclusionRampDownSpeed); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } }
private void Start() { defaultCamParams = new CameraParams(cameraArm.transform.position, cameraArm.transform.eulerAngles, cameraPoint.transform.localPosition * RecountScale()); }
// Constructor public CameraSetupModel(Imager imager, WaveguideDB wgDB, bool AllowCameraConfiguration, bool _isManualMode) { if (imager == null) { return; } if (imager.m_camera == null) { return; } myImager = imager; myCamera = MyImager.m_camera; myWgDB = wgDB; myCamera.GetCameraCapabilities(); // make sure camera properties are updated myWgDB.GetAllCameraSettings(); // make sure camera settings list in wgDB is populated cameraSettingsList = myWgDB.m_cameraSettingsList; if (CameraSettingsList.Count > 0) { CurrentCameraSettings = CameraSettingsList.ElementAt(0); } else { CurrentCameraSettings = new CameraSettingsContainer(); CurrentCameraSettings.CameraSettingID = 0; CurrentCameraSettings.VSSIndex = 0; CurrentCameraSettings.HSSIndex = 0; CurrentCameraSettings.VertClockAmpIndex = 0; CurrentCameraSettings.UseEMAmp = true; CurrentCameraSettings.UseFrameTransfer = true; CurrentCameraSettings.Description = ""; CurrentCameraSettings.IsDefault = true; CurrentCameraSettings.StartingExposure = 2; CurrentCameraSettings.ExposureLimit = 1000; CurrentCameraSettings.HighPixelThresholdPercent = 80; CurrentCameraSettings.LowPixelThresholdPercent = 10; // 60 if !IncreasingSignal (i.e. a decreasing signal) CurrentCameraSettings.MinPercentPixelsAboveLowThreshold = 50; CurrentCameraSettings.MaxPercentPixelsAboveHighThreshold = 10; CurrentCameraSettings.IncreasingSignal = true; CurrentCameraSettings.StartingBinning = 1; CurrentCameraSettings.EMGainLimit = 300; } cameraParams = MyCamera.m_cameraParams; acqParams = MyCamera.m_acqParams; exposure = 1; isOptimizing = false; // set camera capabilities vsspeeds = MyCamera.VSSpeeds; vertClockVoltageAmplitudes = MyCamera.VertClockVoltageAmplitudes; hsspeeds_EM = MyCamera.HSSpeeds_EM; hsspeeds_Conv = MyCamera.HSSpeeds_Conv; if (cameraParams.UseEMAmp) { hsspeeds = hsspeeds_EM; } else { hsspeeds = hsspeeds_Conv; } emGain_LowLimit = MyCamera.EMGain_LowLimit; emGain_HighLimit = MyCamera.EMGain_HighLimit; preAmpGains = MyCamera.PreAmpGains; binningOptions = MyCamera.BinningOptions; // get Camera Parameters cameraParams = MyCamera.m_cameraParams; // get Acquisition Parameters acqParams = MyCamera.m_acqParams; showConfigPanel = false; // start with configuration panel hidden enableConfig = AllowCameraConfiguration; // if false, hides the configuration tab so that configuration cannot be performed isManualMode = _isManualMode; applyMask = true; myWgDB.GetAllExcitationFilters(); exFilterList = new ObservableCollection <FilterContainer>(); foreach (FilterContainer fc in myWgDB.m_filterList) { if (fc.FilterChanger == 1) { exFilterList.Add(fc); } } exFilter = exFilterList[0]; myWgDB.GetAllEmissionFilters(); emFilterList = new ObservableCollection <FilterContainer>(); foreach (FilterContainer fc in myWgDB.m_filterList) { if (fc.FilterChanger == 0) { emFilterList.Add(fc); } } emFilter = emFilterList[0]; sliderLowPosition = 0.0; sliderHighPosition = 100.0; cycleTime = 1; minCycleTime = 1; maxCycleTime = 10000; WellSelectionPBLabel = ""; flatFieldCorrectionItems = new ObservableCollection <FlatFieldCorrectionItem>(); flatFieldCorrectionItems.Add(new FlatFieldCorrectionItem("None", FLATFIELD_SELECT.NONE)); flatFieldCorrectionItems.Add(new FlatFieldCorrectionItem("Fluorescent", FLATFIELD_SELECT.USE_FLUOR)); flatFieldCorrectionItems.Add(new FlatFieldCorrectionItem("Luminescent", FLATFIELD_SELECT.USE_LUMI)); flatFieldSelect = flatFieldCorrectionItems[0]; }
private void SetMoveCamera(CameraParams currentCamera, float lerp) { this._camera.transform.position = Vector3.Lerp(this._currentPosition, currentCamera.currentTarget.position, lerp); this._camera.transform.rotation = Quaternion.Lerp(this._currentRotation, currentCamera.currentTarget.rotation, lerp); this._camera.fieldOfView = Mathf.Lerp(this._currentFieldOfView, currentCamera.fieldOfView, lerp); }
private void DoTargetFollowing(CameraParams t) { if (showTargetFollowParams) { EditorGUI.indentLevel++; /* Rear follow */ LabelField("Rear follow", EditorStyles.boldLabel); t.interpolateTargetFollow = Toggle("Interpolate", t.interpolateTargetFollow); t.desiredOffset = Vector3Field("Desired offset", t.desiredOffset); if (t.interpolateTargetFollow) { LabelField("Follow speeds", EditorStyles.boldLabel); EditorGUI.indentLevel++; t.followSpeedOrientation = FloatField(new GUIContent("Orientation", "How quickly the camera will orient itself horizontally to the target's facing."), t.followSpeedOrientation); t.followSpeedHeight = FloatField(new GUIContent("Height", "How quickly the camera will move towards the target's height + offset."), t.followSpeedHeight); t.followSpeedDistance = FloatField(new GUIContent("Distance", "How quickly the camera will move towards the desired distance from the target."), t.followSpeedDistance); EditorGUI.indentLevel--; } Space(); /* * t.useWorldSpaceOffset = Toggle(new GUIContent("Use world space offset?", "By default, the offset is relative to the follow target's local space." + * " Set this to true to use world space offset."), t.useWorldSpaceOffset); */ /* Front follow */ LabelField("Front follow", EditorStyles.boldLabel); t.allowMoveTowardsCamera = Toggle(new GUIContent("Target can move towards camera?", "Use the desired front offset when the follow target is facing the camera. Typically," + "this is used to let the camera stay in front of the target when the target is moving towards it," + " rather than trying to reorient behind the target."), t.allowMoveTowardsCamera); if (t.allowMoveTowardsCamera) { t.desiredFrontOffset = Vector3Field("Desired front offset", t.desiredFrontOffset); LabelField("Front follow speeds", EditorStyles.boldLabel); EditorGUI.indentLevel++; if (t.interpolateTargetFollow) { t.frontFollowSpeedOrientation = FloatField("Orientation", t.frontFollowSpeedOrientation); } if (t.interpolateTargetFollow) { t.frontFollowSpeedHeight = FloatField("Height", t.frontFollowSpeedHeight); } if (t.interpolateTargetFollow) { t.frontFollowSpeedDistance = FloatField("Distance", t.frontFollowSpeedDistance); } t.movingTowardsCameraAngleRange = Slider("Angle range", t.movingTowardsCameraAngleRange, 0, 90); EditorGUI.indentLevel--; } LabelField("Follow height", EditorStyles.boldLabel); t.followHeightMode = (FollowHeightMode)EnumPopup("Follow height mode", t.followHeightMode); if (t.followHeightMode == FollowHeightMode.AboveGround) { EditorGUI.indentLevel++; t.desiredHeightAboveGround = FloatField("Height above ground", t.desiredHeightAboveGround); t.aboveGroundFallbackHeight = FloatField(new GUIContent("Fallback height above target", "If no valid ground is found below the camera, the camera will move to this height above the target."), t.aboveGroundFallbackHeight); t.maxGroundDistance = FloatField(new GUIContent("Max ground check distance", "The maximum distance to check for ground below the target - greater than this distance, the camera will revert to following relative to the target height."), t.maxGroundDistance); if (t.desiredHeightAboveGround > t.maxGroundDistance) { t.maxGroundDistance = t.desiredHeightAboveGround; //clamp max distance to desired height if necessary } t.maxGroundSlopeAngle = Slider(new GUIContent("Max ground slope angle", "The maximum slope angle at which geometry is counted as \"ground\"."), t.maxGroundSlopeAngle, 0f, 90f); LayerMask groundLayers = MaskField("Ground layer mask", InternalEditorUtility.LayerMaskToConcatenatedLayersMask(t.groundLayerMask), InternalEditorUtility.layers); t.groundLayerMask = InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(groundLayers); EditorGUI.indentLevel--; } LabelField("Clamp min/max distance", EditorStyles.boldLabel); BeginHorizontal(); t.useMinDistance = Toggle("Clamp min distance from target", t.useMinDistance); if (t.useMinDistance) { t.minDistanceFromTarget = FloatField(t.minDistanceFromTarget); } EndHorizontal(); BeginHorizontal(); t.useMaxDistance = Toggle("Clamp max distance from target", t.useMaxDistance); if (t.useMaxDistance) { EditorGUI.indentLevel++; t.maxDistanceFromTarget = FloatField(t.maxDistanceFromTarget); EditorGUI.indentLevel--; } EndHorizontal(); EditorGUI.indentLevel--; } }
public StackInfo(StageZone stageZone, CameraParams camParams) { this.stageZone = stageZone; this.camParams = camParams; }
void OnPreRender() { if (syncMode == SYNC_MODE.LOW_LATENCY) { _imageList = _controller.Images; } if (!_hasFiredCameraParams && OnValidCameraParams != null) { CameraParams cameraParams = new CameraParams(_cachedCamera); OnValidCameraParams(cameraParams); _hasFiredCameraParams = true; } int imageEye = frameEye; switch (retrievedEye) { case EYE.LEFT: imageEye = 0; break; case EYE.RIGHT: imageEye = 1; break; case EYE.RIGHT_TO_LEFT: imageEye = 1 - imageEye; break; default: break; } bool isLeft = imageEye == 0; if (isLeft) { if (OnLeftPreRender != null) { OnLeftPreRender(); } } else { if (OnRightPreRender != null) { OnRightPreRender(); } } Image referenceImage = _imageList[imageEye]; EyeTextureData eyeTextureData = _eyeTextureData[imageEye]; if (referenceImage.Width == 0 || referenceImage.Height == 0) { _missedImages++; if (_missedImages == IMAGE_WARNING_WAIT) { Debug.LogWarning("Can't find any images. " + "Make sure you enabled 'Allow Images' in the Leap Motion Settings, " + "you are on tracking version 2.1+ and " + "your Leap Motion device is plugged in."); } return; } ensureMainTextureUpdated(referenceImage, eyeTextureData); ensureDistortionUpdated(referenceImage, eyeTextureData); updateGlobalShaderProperties(eyeTextureData); frameEye++; }