private void UpdateRigCache() { if (mIsDestroyed) { return; } // Special condition: Did we just get copy/pasted? string[] rigNames = RigNames; if (m_Rigs != null && m_Rigs.Length == rigNames.Length && m_Rigs[0] != null && m_Rigs[0].transform.parent != transform) { DestroyRigs(); m_Rigs = CreateRigs(m_Rigs); } // Early out if we're up to date if (mOrbitals != null && mOrbitals.Length == rigNames.Length) { return; } // Locate existing rigs, and recreate them if any are missing if (LocateExistingRigs(rigNames, false) != rigNames.Length) { DestroyRigs(); m_Rigs = CreateRigs(null); LocateExistingRigs(rigNames, true); } foreach (var rig in m_Rigs) { // Configure the UI rig.m_HideHeaderInInspector = true; rig.m_ExcludedPropertiesInInspector = m_UseCommonLensSetting ? new string[] { "m_Script", "Extensions", "m_Priority", "m_Follow", "m_Lens" } : new string[] { "m_Script", "Extensions", "m_Priority", "m_Follow" }; rig.m_LockStageInInspector = new CinemachineCore.Stage[] { CinemachineCore.Stage.Body }; // Chain into the pipeline callback rig.AddPostPipelineStageHook(PostPipelineStageCallback); } // Create the blend objects mBlendA = new CinemachineBlend(m_Rigs[1], m_Rigs[0], AnimationCurve.Linear(0, 0, 1, 1), 1, 0); mBlendB = new CinemachineBlend(m_Rigs[2], m_Rigs[1], AnimationCurve.Linear(0, 0, 1, 1), 1, 0); // Horizontal rotation clamped to [0,360] (with wraparound) m_XAxis.SetThresholds(0f, 360f, true); // Vertical rotation cleamped to [0,1] as it is a t-value for the // catmull-rom spline going through the 3 points on the rig m_YAxis.SetThresholds(0f, 1f, false); }
void Awake() { #if false // make this true for CM 2.1.10 and earlier, false otherwise zAxis.SetThresholds(0, 1, false); #endif freelook = GetComponentInChildren <CinemachineFreeLook>(); if (freelook != null && originalOrbits.Length == 0) { zAxis.Update(Time.deltaTime); float scale = Mathf.Lerp(minScale, maxScale, zAxis.Value); for (int i = 0; i < Mathf.Min(originalOrbits.Length, freelook.m_Orbits.Length); i++) { freelook.m_Orbits[i].m_Height = originalOrbits[i].m_Height * scale; freelook.m_Orbits[i].m_Radius = originalOrbits[i].m_Radius * scale; } } }
private void OnEnable() { m_HorizontalAxis.SetThresholds(-180f, 180f, true); m_VerticalAxis.SetThresholds(-90, 90, false); }