private static void DrawFreeLookGizmos(CinemachineNewFreeLook vcam, GizmoType selectionType) { // Standard frustum and logo CinemachineBrainEditor.DrawVirtualCameraBaseGizmos(vcam, selectionType); Color originalGizmoColour = Gizmos.color; bool isActiveVirtualCam = CinemachineCore.Instance.IsLive(vcam); Gizmos.color = isActiveVirtualCam ? CinemachineSettings.CinemachineCoreSettings.ActiveGizmoColour : CinemachineSettings.CinemachineCoreSettings.InactiveGizmoColour; if (vcam.Follow != null) { Vector3 pos = vcam.Follow.position; Vector3 up = Vector3.up; CinemachineBrain brain = CinemachineCore.Instance.FindPotentialTargetBrain(vcam); if (brain != null) { up = brain.DefaultWorldUp; } var middleRig = vcam.GetComponent <CinemachineTransposer>(); if (middleRig != null) { float scale = vcam.m_RadialAxis.Value; Quaternion orient = middleRig.GetReferenceOrientation(up); up = orient * Vector3.up; var orbital = middleRig as CinemachineOrbitalTransposer; if (orbital != null) { float rotation = orbital.m_XAxis.Value + orbital.m_Heading.m_Bias; orient = Quaternion.AngleAxis(rotation, up) * orient; } CinemachineOrbitalTransposerEditor.DrawCircleAtPointWithRadius( pos + up * vcam.m_Orbits[0].m_Height * scale, orient, vcam.m_Orbits[0].m_Radius * scale); CinemachineOrbitalTransposerEditor.DrawCircleAtPointWithRadius( pos + up * vcam.m_Orbits[1].m_Height * scale, orient, vcam.m_Orbits[1].m_Radius * scale); CinemachineOrbitalTransposerEditor.DrawCircleAtPointWithRadius( pos + up * vcam.m_Orbits[2].m_Height * scale, orient, vcam.m_Orbits[2].m_Radius * scale); DrawCameraPath(pos, orient, vcam); } } Gizmos.color = originalGizmoColour; }
private static void DrawFreeLookGizmos(CinemachineFreeLook vcam, GizmoType selectionType) { // Standard frustum and logo CinemachineBrainEditor.DrawVirtualCameraBaseGizmos(vcam, selectionType); Color originalGizmoColour = Gizmos.color; bool isActiveVirtualCam = CinemachineCore.Instance.IsLive(vcam); Gizmos.color = isActiveVirtualCam ? CinemachineSettings.CinemachineCoreSettings.ActiveGizmoColour : CinemachineSettings.CinemachineCoreSettings.InactiveGizmoColour; if (vcam.Follow != null) { Vector3 pos = vcam.Follow.position; var TopRig = vcam.GetRig(0).GetCinemachineComponent <CinemachineOrbitalTransposer>(); var MiddleRig = vcam.GetRig(1).GetCinemachineComponent <CinemachineOrbitalTransposer>(); var BottomRig = vcam.GetRig(2).GetCinemachineComponent <CinemachineOrbitalTransposer>(); Vector3 up = Vector3.up; CinemachineBrain brain = CinemachineCore.Instance.FindPotentialTargetBrain(vcam); if (brain != null) { up = brain.DefaultWorldUp; } Quaternion orient = TopRig.GetReferenceOrientation(up); up = orient * Vector3.up; float rotation = vcam.m_XAxis.Value + vcam.m_Heading.m_HeadingBias; orient = Quaternion.AngleAxis(rotation, up) * orient; CinemachineOrbitalTransposerEditor.DrawCircleAtPointWithRadius( pos + up * TopRig.m_FollowOffset.y, orient, TopRig.m_FollowOffset.z); CinemachineOrbitalTransposerEditor.DrawCircleAtPointWithRadius( pos + up * MiddleRig.m_FollowOffset.y, orient, MiddleRig.m_FollowOffset.z); CinemachineOrbitalTransposerEditor.DrawCircleAtPointWithRadius( pos + up * BottomRig.m_FollowOffset.y, orient, BottomRig.m_FollowOffset.z); DrawCameraPath(pos, orient, vcam); } Gizmos.color = originalGizmoColour; }
private static void DrawFreeLookGizmos(CinemachineFreeLook vcam, GizmoType selectionType) { // Standard frustum and logo CinemachineBrainEditor.DrawVirtualCameraBaseGizmos(vcam, selectionType); Color originalGizmoColour = Gizmos.color; bool isActiveVirtualCam = CinemachineCore.Instance.IsLive(vcam); Gizmos.color = isActiveVirtualCam ? CinemachineSettings.CinemachineCoreSettings.ActiveGizmoColour : CinemachineSettings.CinemachineCoreSettings.InactiveGizmoColour; if (vcam.Follow != null) { Vector3 pos = vcam.Follow.position; Vector3 up = vcam.State.ReferenceUp; var MiddleRig = vcam.GetRig(1).GetCinemachineComponent <CinemachineOrbitalTransposer>(); if (MiddleRig != null) { Quaternion orient = MiddleRig.GetReferenceOrientation(up); up = orient * Vector3.up; float rotation = vcam.m_XAxis.Value + vcam.m_Heading.m_Bias; orient = Quaternion.AngleAxis(rotation, up) * orient; CinemachineOrbitalTransposerEditor.DrawCircleAtPointWithRadius( pos + up * vcam.m_Orbits[0].m_Height, orient, vcam.m_Orbits[0].m_Radius); CinemachineOrbitalTransposerEditor.DrawCircleAtPointWithRadius( pos + up * vcam.m_Orbits[1].m_Height, orient, vcam.m_Orbits[1].m_Radius); CinemachineOrbitalTransposerEditor.DrawCircleAtPointWithRadius( pos + up * vcam.m_Orbits[2].m_Height, orient, vcam.m_Orbits[2].m_Radius); DrawCameraPath(pos, orient, vcam); } } Gizmos.color = originalGizmoColour; }