From 7d263e2b709a4470daed63c6e7a11203b7bb5573 Mon Sep 17 00:00:00 2001 From: Gregory Labute Date: Wed, 10 Sep 2025 13:23:07 -0400 Subject: [PATCH 1/9] Added PerspectiveToOrthoCustomBlendsample scene, rename CustomBlend sample to EarlyLookAtCustomBlend --- com.unity.cinemachine/CHANGELOG.md | 3 +- .../Custom Blends/BlendStyleManager.cs | 65 -- ...nds.unity => EarlyLookAtCustomBlend.unity} | 919 +++++++++--------- ...meta => EarlyLookAtCustomBlend.unity.meta} | 2 +- .../PerspectiveToOrthoCustomBlend.unity | 788 +++++++++++++++ ... PerspectiveToOrthoCustomBlend.unity.meta} | 3 +- .../Scripts/EarlyLookAtCustomBlender.cs | 72 ++ .../Scripts/EarlyLookAtCustomBlender.cs.meta} | 0 .../PerspectiveToOrthoCustomBlender.cs | 110 +++ .../PerspectiveToOrthoCustomBlender.cs.meta | 2 + .../AlternatingCamerasTimeline.playable | 302 ++++++ .../AlternatingCamerasTimeline.playable.meta | 8 + .../Shared Assets/UI/SamplesUIStyle.uss | 4 +- 13 files changed, 1728 insertions(+), 550 deletions(-) delete mode 100644 com.unity.cinemachine/Samples~/3D Samples/Custom Blends/BlendStyleManager.cs rename com.unity.cinemachine/Samples~/3D Samples/{Custom Blends/Custom Blends.unity => EarlyLookAtCustomBlend.unity} (84%) rename com.unity.cinemachine/Samples~/3D Samples/{Custom Blends/Custom Blends.unity.meta => EarlyLookAtCustomBlend.unity.meta} (74%) create mode 100644 com.unity.cinemachine/Samples~/3D Samples/PerspectiveToOrthoCustomBlend.unity rename com.unity.cinemachine/Samples~/3D Samples/{Custom Blends.meta => PerspectiveToOrthoCustomBlend.unity.meta} (67%) create mode 100644 com.unity.cinemachine/Samples~/Shared Assets/Scripts/EarlyLookAtCustomBlender.cs rename com.unity.cinemachine/Samples~/{3D Samples/Custom Blends/BlendStyleManager.cs.meta => Shared Assets/Scripts/EarlyLookAtCustomBlender.cs.meta} (100%) create mode 100644 com.unity.cinemachine/Samples~/Shared Assets/Scripts/PerspectiveToOrthoCustomBlender.cs create mode 100644 com.unity.cinemachine/Samples~/Shared Assets/Scripts/PerspectiveToOrthoCustomBlender.cs.meta create mode 100644 com.unity.cinemachine/Samples~/Shared Assets/Timelines/AlternatingCamerasTimeline.playable create mode 100644 com.unity.cinemachine/Samples~/Shared Assets/Timelines/AlternatingCamerasTimeline.playable.meta diff --git a/com.unity.cinemachine/CHANGELOG.md b/com.unity.cinemachine/CHANGELOG.md index fc91c9780..026d9bcaf 100644 --- a/com.unity.cinemachine/CHANGELOG.md +++ b/com.unity.cinemachine/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [3.1.5] - 2025-012-31 +## [3.1.5] - 2025-12-31 ### Unreleased ### Bugfixes @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added `CinemachineConfiner2D.CameraWasDisplaced()` and `CinemachineConfiner2D.GetCameraDisplacementDistance()` methods. - Added `InputAxisControllerBase.GetController()` method, to conveniently fetch an Input Controller having a specific name. - Added `InputAxisControllerBase.TriggerRecentering()` to trigger recentering of an axis having a specific name. +- Added PerspectiveToOrthoCustomBlend sample scene. ## [3.1.4] - 2025-06-10 diff --git a/com.unity.cinemachine/Samples~/3D Samples/Custom Blends/BlendStyleManager.cs b/com.unity.cinemachine/Samples~/3D Samples/Custom Blends/BlendStyleManager.cs deleted file mode 100644 index 85884b096..000000000 --- a/com.unity.cinemachine/Samples~/3D Samples/Custom Blends/BlendStyleManager.cs +++ /dev/null @@ -1,65 +0,0 @@ -using UnityEngine; - -namespace Unity.Cinemachine.Samples -{ - public class BlendStyleManager : MonoBehaviour - { - class EarlyLookBlender : CinemachineBlend.IBlender - { - // This method is free to blend the states any way it likes. - // In this case, we do a default blend then override the rotation to make - // it happen at the beginning of the blend. - public CameraState GetIntermediateState(ICinemachineCamera CamA, ICinemachineCamera CamB, float t) - { - var stateA = CamA.State; - var stateB = CamB.State; - - // Standard blend - first we disable cylindrical position - stateA.BlendHint &= ~CameraState.BlendHints.CylindricalPositionBlend; - stateB.BlendHint &= ~CameraState.BlendHints.CylindricalPositionBlend; - var state = CameraState.Lerp(stateA, stateB, t); - - // Override the rotation blend: look directly at the new target - // at the start of the blend - const float kFinishRotatingAt = 0.2f; - var rotB = Quaternion.LookRotation( - stateB.ReferenceLookAt - state.RawPosition, state.ReferenceUp); - state.RawOrientation = Quaternion.Slerp( - stateA.RawOrientation, rotB, Damper.Damp(1, kFinishRotatingAt, t)); - - return state; - } - } - - EarlyLookBlender m_CustomBlender = new (); - - bool m_UseCustomBlend; - - public void OnBlendCreated(CinemachineCore.BlendEventParams evt) - { - // Override the blender with a custom blender - if (m_UseCustomBlend) - evt.Blend.CustomBlender = m_CustomBlender; - } - - public void DefaultBlend() - { - m_UseCustomBlend = false; - ChangeCamera(); - } - - public void CustomBlend() - { - m_UseCustomBlend = true; - ChangeCamera(); - } - - void ChangeCamera() - { - // Cycle through all the virtual cameras, assuming that they all have the same priority. - // Prioritize the least-recently used one. - int numCameras = CinemachineCore.VirtualCameraCount; - CinemachineCore.GetVirtualCamera(numCameras - 1).Prioritize(); - } - } -} \ No newline at end of file diff --git a/com.unity.cinemachine/Samples~/3D Samples/Custom Blends/Custom Blends.unity b/com.unity.cinemachine/Samples~/3D Samples/EarlyLookAtCustomBlend.unity similarity index 84% rename from com.unity.cinemachine/Samples~/3D Samples/Custom Blends/Custom Blends.unity rename to com.unity.cinemachine/Samples~/3D Samples/EarlyLookAtCustomBlend.unity index 76c27c8c1..c7d7ff14f 100644 --- a/com.unity.cinemachine/Samples~/3D Samples/Custom Blends/Custom Blends.unity +++ b/com.unity.cinemachine/Samples~/3D Samples/EarlyLookAtCustomBlend.unity @@ -13,7 +13,7 @@ OcclusionCullingSettings: --- !u!104 &2 RenderSettings: m_ObjectHideFlags: 0 - serializedVersion: 9 + serializedVersion: 10 m_Fog: 0 m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} m_FogMode: 3 @@ -38,13 +38,12 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 - serializedVersion: 12 - m_GIWorkflowMode: 1 + serializedVersion: 13 + m_BakeOnSceneLoad: 0 m_GISettings: serializedVersion: 2 m_BounceScale: 1 @@ -67,9 +66,6 @@ LightmapSettings: m_LightmapParameters: {fileID: 0} m_LightmapsBakeMode: 1 m_TextureCompression: 1 - m_FinalGather: 0 - m_FinalGatherFiltering: 1 - m_FinalGatherRayCount: 256 m_ReflectionCompression: 2 m_MixedBakeMode: 2 m_BakeBackend: 1 @@ -89,15 +85,15 @@ LightmapSettings: m_PVREnvironmentMIS: 1 m_PVRCulling: 1 m_PVRFilteringGaussRadiusDirect: 1 - m_PVRFilteringGaussRadiusIndirect: 5 - m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringGaussRadiusIndirect: 1 + m_PVRFilteringGaussRadiusAO: 1 m_PVRFilteringAtrousPositionSigmaDirect: 0.5 m_PVRFilteringAtrousPositionSigmaIndirect: 2 m_PVRFilteringAtrousPositionSigmaAO: 1 m_ExportTrainingData: 0 m_TrainingDataDestination: TrainingData m_LightProbeSampleCountMultiplier: 4 - m_LightingDataAsset: {fileID: 0} + m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0} m_LightingSettings: {fileID: 0} --- !u!196 &4 NavMeshSettings: @@ -123,7 +119,7 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} ---- !u!1001 &95774409 +--- !u!1001 &1739845177 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 @@ -131,10 +127,6 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 4436525663902916665, guid: c97e1248c10cd3549b3d18c1eb1c3722, type: 3} - propertyPath: m_RootOrder - value: 1 - objectReference: {fileID: 0} - target: {fileID: 4436525663902916665, guid: c97e1248c10cd3549b3d18c1eb1c3722, type: 3} propertyPath: m_LocalPosition.x value: 0 @@ -184,7 +176,7 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c97e1248c10cd3549b3d18c1eb1c3722, type: 3} ---- !u!1 &486393343 +--- !u!1 &1755976530 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -192,87 +184,156 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 486393344} - - component: {fileID: 486393346} - - component: {fileID: 486393345} + - component: {fileID: 1755976533} + - component: {fileID: 1755976532} + - component: {fileID: 1755976531} + - component: {fileID: 1755976534} m_Layer: 0 - m_Name: Blend Style Manager - m_TagString: Untagged + m_Name: Main Camera + m_TagString: MainCamera m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &486393344 +--- !u!81 &1755976531 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1755976530} + m_Enabled: 1 +--- !u!20 &1755976532 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1755976530} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 73.97209 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1755976533 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 486393343} + m_GameObject: {fileID: 1755976530} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 9.632949, y: 3.0888271, z: -0.0033988953} + m_LocalPosition: {x: 30, y: 1, z: -3} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &486393345 +--- !u!114 &1755976534 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 486393343} + m_GameObject: {fileID: 1755976530} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 16eca234a25d87f4e9a54ac550e684e9, type: 3} + m_Script: {fileID: 11500000, guid: 72ece51f2901e7445ab60da3685d6b5f, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &486393346 -MonoBehaviour: + ShowDebugText: 0 + ShowCameraFrustum: 1 + IgnoreTimeScale: 0 + WorldUpOverride: {fileID: 0} + ChannelMask: -1 + UpdateMethod: 2 + BlendUpdateMethod: 1 + LensModeOverride: + Enabled: 0 + DefaultMode: 2 + DefaultBlend: + Style: 1 + Time: 2 + CustomCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + CustomBlends: {fileID: 0} +--- !u!1 &1236484502019717275 +GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 486393343} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 33a510488cc26384ea9c0600441770b2, type: 3} - m_Name: - m_EditorClassIdentifier: - CameraActivatedEvent: - m_PersistentCalls: - m_Calls: [] - CameraDeactivatedEvent: - m_PersistentCalls: - m_Calls: [] - BlendCreatedEvent: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 486393345} - m_TargetAssemblyTypeName: Unity.Cinemachine.Samples.BlendStyleManager, Assembly-CSharp - m_MethodName: OnBlendCreated - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 - BlendFinishedEvent: - m_PersistentCalls: - m_Calls: [] - CameraCutEvent: - m_PersistentCalls: - m_Calls: [] - Brain: {fileID: 1990246957} - BrainUpdatedEvent: - m_PersistentCalls: - m_Calls: [] ---- !u!1001 &493586491 + serializedVersion: 6 + m_Component: + - component: {fileID: 1998785112375921186} + - component: {fileID: 9146615824183608277} + m_Layer: 0 + m_Name: Custom Blender + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1998785112375921186 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1236484502019717275} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 9.632949, y: 3.0888271, z: -0.0033988953} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &2151026527279703310 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 @@ -280,106 +341,157 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 3521509573382385251, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} - propertyPath: m_Name - value: Green Player - objectReference: {fileID: 0} - - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} propertyPath: m_RootOrder - value: 4 + value: 0 objectReference: {fileID: 0} - - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} propertyPath: m_LocalPosition.x - value: 30 + value: 0 objectReference: {fileID: 0} - - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} propertyPath: m_LocalRotation.x - value: 0 + value: -0 objectReference: {fileID: 0} - - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} propertyPath: m_LocalRotation.y - value: 0 + value: -0 objectReference: {fileID: 0} - - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} propertyPath: m_LocalRotation.z - value: 0 + value: -0 objectReference: {fileID: 0} - - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 7157490968562004111, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} - propertyPath: m_Materials.Array.data[0] - value: - objectReference: {fileID: 2100000, guid: 2125c72c59dd24bbfa7687d45ac370de, type: 2} + - target: {fileID: 6668015293666917239, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + propertyPath: HelpText + value: 'This scene shows how to customize the camera blending algorithm. There + are two players, each with a follow camera. Use WASD to move the players. + + + The + Custom Blender object has a custom script that hooks into CinemachineCore.GetCustomBlender + and returns a custom blender, in cases where a custom blend is desired - + that is, when the user presses the Custom Blend button. + + + The + custom blend looks quickly at the new target at the start of the blend, then + lerps the camera position, while the default blend lerps the camera position + and the LookAt target simultaneously. + +' + objectReference: {fileID: 0} + - target: {fileID: 9138370430051789472, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + propertyPath: m_Name + value: HelpUI + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} ---- !u!4 &493586492 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} - m_PrefabInstance: {fileID: 493586491} - m_PrefabAsset: {fileID: 0} ---- !u!1 &614925373 + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 9138370430051789472, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + insertIndex: -1 + addedObject: {fileID: 2768171871138717908} + m_SourcePrefab: {fileID: 100100000, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} +--- !u!1 &2151026527279703311 stripped GameObject: + m_CorrespondingSourceObject: {fileID: 9138370430051789472, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + m_PrefabInstance: {fileID: 2151026527279703310} + m_PrefabAsset: {fileID: 0} +--- !u!114 &2768171871138717908 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 614925377} - - component: {fileID: 614925376} - - component: {fileID: 614925375} - - component: {fileID: 614925374} - m_Layer: 0 - m_Name: CinemachineCamera - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &614925374 + m_GameObject: {fileID: 2151026527279703311} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7950c6f52d74a4772bb69c03fe19a19b, type: 3} + m_Name: + m_EditorClassIdentifier: + Buttons: + - Name: Default Blend + IsToggle: + Enabled: 0 + Value: 0 + OnValueChanged: + m_PersistentCalls: + m_Calls: [] + OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 9146615824183608277} + m_TargetAssemblyTypeName: Unity.Cinemachine.Samples.BlendStyleManager, + Assembly-CSharp + m_MethodName: DefaultBlend + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + - Name: Custom Blend + IsToggle: + Enabled: 0 + Value: 0 + OnValueChanged: + m_PersistentCalls: + m_Calls: [] + OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 9146615824183608277} + m_TargetAssemblyTypeName: Unity.Cinemachine.Samples.BlendStyleManager, + Assembly-CSharp + m_MethodName: CustomBlend + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 +--- !u!114 &3067931511349345184 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 614925373} + m_GameObject: {fileID: 7401989312730020560} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: f38bda98361e1de48a4ca2bd86ea3c17, type: 3} m_Name: m_EditorClassIdentifier: - TargetOffset: {x: 0, y: 1, z: 0} - Lookahead: - Enabled: 0 - Time: 0 - Smoothing: 0 - IgnoreY: 0 - Damping: {x: 0.5, y: 0.5} Composition: ScreenPosition: {x: 0, y: 0} DeadZone: @@ -390,46 +502,34 @@ MonoBehaviour: Size: {x: 0.8, y: 0.8} Offset: {x: 0, y: 0} CenterOnActivate: 1 ---- !u!114 &614925375 + TargetOffset: {x: 0, y: 1, z: 0} + Damping: {x: 0.5, y: 0.5} + Lookahead: + Enabled: 0 + Time: 0 + Smoothing: 0 + IgnoreY: 0 +--- !u!114 &3467771027814010776 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 614925373} + m_GameObject: {fileID: 7401989312730020560} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b617507da6d07e749b7efdb34e1173e1, type: 3} - m_Name: - m_EditorClassIdentifier: - FollowOffset: {x: 0, y: 1, z: -3} - TrackerSettings: - BindingMode: 5 - PositionDamping: {x: 1, y: 1, z: 1} - AngularDampingMode: 0 - RotationDamping: {x: 1, y: 1, z: 1} - QuaternionDamping: 1 ---- !u!114 &614925376 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 614925373} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f9dfa5b682dcd46bda6128250e975f58, type: 3} + m_Script: {fileID: 11500000, guid: f9dfa5b682dcd46bda6128250e975f58, type: 3} m_Name: m_EditorClassIdentifier: Priority: - Enabled: 0 - m_Value: 0 + Enabled: 1 + m_Value: 10 OutputChannel: 1 StandbyUpdate: 2 - m_StreamingVersion: 0 - m_LegacyPriority: 10 + m_StreamingVersion: 20241001 + m_LegacyPriority: 0 Target: - TrackingTarget: {fileID: 1475538426} + TrackingTarget: {fileID: 5151640508548093568} LookAtTarget: {fileID: 0} CustomLookAtTarget: 0 Lens: @@ -452,22 +552,7 @@ MonoBehaviour: BarrelClipping: 0.25 Anamorphism: 0 BlendHint: 10 ---- !u!4 &614925377 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 614925373} - m_LocalRotation: {x: -3e-45, y: 1e-45, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 1, z: -3} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 5 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &970848196 +--- !u!1 &3756481576293266372 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -475,10 +560,10 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 970848200} - - component: {fileID: 970848199} - - component: {fileID: 970848198} - - component: {fileID: 970848197} + - component: {fileID: 7397591933725069492} + - component: {fileID: 5499105393360986420} + - component: {fileID: 8364104522682113384} + - component: {fileID: 5496141630218045917} m_Layer: 0 m_Name: CinemachineCamera Green m_TagString: Untagged @@ -486,113 +571,7 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!114 &970848197 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 970848196} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f38bda98361e1de48a4ca2bd86ea3c17, type: 3} - m_Name: - m_EditorClassIdentifier: - TargetOffset: {x: 0, y: 1, z: 0} - Lookahead: - Enabled: 0 - Time: 0 - Smoothing: 0 - IgnoreY: 0 - Damping: {x: 0.5, y: 0.5} - Composition: - ScreenPosition: {x: 0, y: 0} - DeadZone: - Enabled: 0 - Size: {x: 0.2, y: 0.2} - HardLimits: - Enabled: 0 - Size: {x: 0.8, y: 0.8} - Offset: {x: 0, y: 0} - CenterOnActivate: 1 ---- !u!114 &970848198 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 970848196} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b617507da6d07e749b7efdb34e1173e1, type: 3} - m_Name: - m_EditorClassIdentifier: - FollowOffset: {x: 0, y: 1, z: -3} - TrackerSettings: - BindingMode: 5 - PositionDamping: {x: 1, y: 1, z: 1} - AngularDampingMode: 0 - RotationDamping: {x: 1, y: 1, z: 1} - QuaternionDamping: 1 ---- !u!114 &970848199 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 970848196} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f9dfa5b682dcd46bda6128250e975f58, type: 3} - m_Name: - m_EditorClassIdentifier: - Priority: - Enabled: 0 - m_Value: 0 - OutputChannel: 1 - StandbyUpdate: 2 - m_StreamingVersion: 0 - m_LegacyPriority: 10 - Target: - TrackingTarget: {fileID: 493586492} - LookAtTarget: {fileID: 0} - CustomLookAtTarget: 0 - Lens: - FieldOfView: 73.97209 - OrthographicSize: 5 - NearClipPlane: 0.3 - FarClipPlane: 1000 - Dutch: 0 - ModeOverride: 0 - PhysicalProperties: - GateFit: 2 - SensorSize: {x: 21.946, y: 16.002} - LensShift: {x: 0, y: 0} - FocusDistance: 10 - Iso: 200 - ShutterSpeed: 0.005 - Aperture: 16 - BladeCount: 5 - Curvature: {x: 2, y: 11} - BarrelClipping: 0.25 - Anamorphism: 0 - BlendHint: 10 ---- !u!4 &970848200 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 970848196} - m_LocalRotation: {x: 1e-45, y: 1e-45, z: -0, w: 1} - m_LocalPosition: {x: 30, y: 1, z: -3} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 6 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &996105182 +--- !u!1001 &3982833496974744724 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 @@ -600,145 +579,69 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + - target: {fileID: 3521509573382385251, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + propertyPath: m_Name + value: Green Player + objectReference: {fileID: 0} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} propertyPath: m_RootOrder - value: 0 + value: 4 objectReference: {fileID: 0} - - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} propertyPath: m_LocalPosition.x - value: 0 + value: 30 objectReference: {fileID: 0} - - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} propertyPath: m_LocalRotation.x - value: 0 + value: -0 objectReference: {fileID: 0} - - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} propertyPath: m_LocalRotation.y - value: 0 + value: -0 objectReference: {fileID: 0} - - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} propertyPath: m_LocalRotation.z - value: 0 + value: -0 objectReference: {fileID: 0} - - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 6668015293666917239, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} - propertyPath: HelpText - value: 'This scene shows how to customize the camera blending algorithm. There - are two players, each with a follow camera. Use WASD to move the players. - - - The - Blend Style Manager object has a custom script that listens for BlendCreated - events and assigns a custom blender to the blend in cases where a custom - blend is desired - that is, when the user presses the Custom Blend - button. - - - The CinemachineBrainEvents script is used to listen for - the event. - -' - objectReference: {fileID: 0} - - target: {fileID: 9138370430051789472, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} - propertyPath: m_Name - value: HelpUI - objectReference: {fileID: 0} + - target: {fileID: 7157490968562004111, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + propertyPath: 'm_Materials.Array.data[0]' + value: + objectReference: {fileID: 2100000, guid: 2125c72c59dd24bbfa7687d45ac370de, type: 2} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: - - targetCorrespondingSourceObject: {fileID: 9138370430051789472, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} - insertIndex: -1 - addedObject: {fileID: 996105184} - m_SourcePrefab: {fileID: 100100000, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} ---- !u!1 &996105183 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 9138370430051789472, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} - m_PrefabInstance: {fileID: 996105182} - m_PrefabAsset: {fileID: 0} ---- !u!114 &996105184 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} +--- !u!4 &3982833496974744725 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + m_PrefabInstance: {fileID: 3982833496974744724} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 996105183} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7950c6f52d74a4772bb69c03fe19a19b, type: 3} - m_Name: - m_EditorClassIdentifier: - Buttons: - - Name: Default Blend - IsToggle: - Enabled: 0 - Value: 0 - OnValueChanged: - m_PersistentCalls: - m_Calls: [] - OnClick: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 486393345} - m_TargetAssemblyTypeName: Unity.Cinemachine.Samples.BlendStyleManager, - Assembly-CSharp - m_MethodName: DefaultBlend - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 - - Name: Custom Blend - IsToggle: - Enabled: 0 - Value: 0 - OnValueChanged: - m_PersistentCalls: - m_Calls: [] - OnClick: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 486393345} - m_TargetAssemblyTypeName: Unity.Cinemachine.Samples.BlendStyleManager, - Assembly-CSharp - m_MethodName: CustomBlend - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 ---- !u!1001 &1475538425 +--- !u!1001 &5151640508548093567 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 @@ -772,15 +675,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} propertyPath: m_LocalRotation.x - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} propertyPath: m_LocalRotation.y - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} propertyPath: m_LocalRotation.z - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -799,12 +702,99 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} ---- !u!4 &1475538426 stripped +--- !u!4 &5151640508548093568 stripped Transform: m_CorrespondingSourceObject: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} - m_PrefabInstance: {fileID: 1475538425} + m_PrefabInstance: {fileID: 5151640508548093567} + m_PrefabAsset: {fileID: 0} +--- !u!114 &5496141630218045917 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} ---- !u!1 &1990246953 + m_GameObject: {fileID: 3756481576293266372} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f38bda98361e1de48a4ca2bd86ea3c17, type: 3} + m_Name: + m_EditorClassIdentifier: + Composition: + ScreenPosition: {x: 0, y: 0} + DeadZone: + Enabled: 0 + Size: {x: 0.2, y: 0.2} + HardLimits: + Enabled: 0 + Size: {x: 0.8, y: 0.8} + Offset: {x: 0, y: 0} + CenterOnActivate: 1 + TargetOffset: {x: 0, y: 1, z: 0} + Damping: {x: 0.5, y: 0.5} + Lookahead: + Enabled: 0 + Time: 0 + Smoothing: 0 + IgnoreY: 0 +--- !u!114 &5499105393360986420 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3756481576293266372} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f9dfa5b682dcd46bda6128250e975f58, type: 3} + m_Name: + m_EditorClassIdentifier: + Priority: + Enabled: 1 + m_Value: 10 + OutputChannel: 1 + StandbyUpdate: 2 + m_StreamingVersion: 20241001 + m_LegacyPriority: 0 + Target: + TrackingTarget: {fileID: 3982833496974744725} + LookAtTarget: {fileID: 0} + CustomLookAtTarget: 0 + Lens: + FieldOfView: 73.97209 + OrthographicSize: 5 + NearClipPlane: 0.3 + FarClipPlane: 1000 + Dutch: 0 + ModeOverride: 0 + PhysicalProperties: + GateFit: 2 + SensorSize: {x: 21.946, y: 16.002} + LensShift: {x: 0, y: 0} + FocusDistance: 10 + Iso: 200 + ShutterSpeed: 0.005 + Aperture: 16 + BladeCount: 5 + Curvature: {x: 2, y: 11} + BarrelClipping: 0.25 + Anamorphism: 0 + BlendHint: 10 +--- !u!4 &7397591933725069492 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3756481576293266372} + serializedVersion: 2 + m_LocalRotation: {x: 1e-45, y: 1e-45, z: -0, w: 1} + m_LocalPosition: {x: 30, y: 1, z: -3} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &7401989312730020560 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -812,120 +802,91 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 1990246956} - - component: {fileID: 1990246955} - - component: {fileID: 1990246954} - - component: {fileID: 1990246957} + - component: {fileID: 9186306595794693915} + - component: {fileID: 3467771027814010776} + - component: {fileID: 8197785128381583462} + - component: {fileID: 3067931511349345184} m_Layer: 0 - m_Name: Main Camera - m_TagString: MainCamera + m_Name: CinemachineCamera + m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!81 &1990246954 -AudioListener: +--- !u!114 &8197785128381583462 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1990246953} + m_GameObject: {fileID: 7401989312730020560} m_Enabled: 1 ---- !u!20 &1990246955 -Camera: + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b617507da6d07e749b7efdb34e1173e1, type: 3} + m_Name: + m_EditorClassIdentifier: + TrackerSettings: + BindingMode: 5 + PositionDamping: {x: 1, y: 1, z: 1} + AngularDampingMode: 0 + RotationDamping: {x: 1, y: 1, z: 1} + QuaternionDamping: 1 + FollowOffset: {x: 0, y: 1, z: -3} +--- !u!114 &8364104522682113384 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1990246953} + m_GameObject: {fileID: 3756481576293266372} m_Enabled: 1 - serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} - m_projectionMatrixMode: 1 - m_GateFitMode: 2 - m_FOVAxisMode: 0 - m_Iso: 200 - m_ShutterSpeed: 0.005 - m_Aperture: 16 - m_FocusDistance: 10 - m_FocalLength: 50 - m_BladeCount: 5 - m_Curvature: {x: 2, y: 11} - m_BarrelClipping: 0.25 - m_Anamorphism: 0 - m_SensorSize: {x: 36, y: 24} - m_LensShift: {x: 0, y: 0} - m_NormalizedViewPortRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 - near clip plane: 0.3 - far clip plane: 1000 - field of view: 73.97209 - orthographic: 0 - orthographic size: 5 - m_Depth: -1 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_RenderingPath: -1 - m_TargetTexture: {fileID: 0} - m_TargetDisplay: 0 - m_TargetEye: 3 - m_HDR: 1 - m_AllowMSAA: 1 - m_AllowDynamicResolution: 0 - m_ForceIntoRT: 0 - m_OcclusionCulling: 1 - m_StereoConvergence: 10 - m_StereoSeparation: 0.022 ---- !u!4 &1990246956 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b617507da6d07e749b7efdb34e1173e1, type: 3} + m_Name: + m_EditorClassIdentifier: + TrackerSettings: + BindingMode: 5 + PositionDamping: {x: 1, y: 1, z: 1} + AngularDampingMode: 0 + RotationDamping: {x: 1, y: 1, z: 1} + QuaternionDamping: 1 + FollowOffset: {x: 0, y: 1, z: -3} +--- !u!114 &9146615824183608277 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1236484502019717275} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 16eca234a25d87f4e9a54ac550e684e9, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &9186306595794693915 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1990246953} - m_LocalRotation: {x: -3e-45, y: 1e-45, z: 0, w: 1} + m_GameObject: {fileID: 7401989312730020560} + serializedVersion: 2 + m_LocalRotation: {x: -3e-45, y: 1e-45, z: -0, w: 1} m_LocalPosition: {x: 0, y: 1, z: -3} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1990246957 -MonoBehaviour: +--- !u!1660057539 &9223372036854775807 +SceneRoots: m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1990246953} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 72ece51f2901e7445ab60da3685d6b5f, type: 3} - m_Name: - m_EditorClassIdentifier: - ShowDebugText: 0 - ShowCameraFrustum: 1 - IgnoreTimeScale: 0 - WorldUpOverride: {fileID: 0} - ChannelMask: -1 - UpdateMethod: 2 - BlendUpdateMethod: 1 - LensModeOverride: - Enabled: 0 - DefaultMode: 2 - DefaultBlend: - Style: 1 - Time: 2 - CustomCurve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - CustomBlends: {fileID: 0} + m_Roots: + - {fileID: 1755976533} + - {fileID: 1739845177} + - {fileID: 2151026527279703310} + - {fileID: 5151640508548093567} + - {fileID: 3982833496974744724} + - {fileID: 9186306595794693915} + - {fileID: 7397591933725069492} + - {fileID: 1998785112375921186} diff --git a/com.unity.cinemachine/Samples~/3D Samples/Custom Blends/Custom Blends.unity.meta b/com.unity.cinemachine/Samples~/3D Samples/EarlyLookAtCustomBlend.unity.meta similarity index 74% rename from com.unity.cinemachine/Samples~/3D Samples/Custom Blends/Custom Blends.unity.meta rename to com.unity.cinemachine/Samples~/3D Samples/EarlyLookAtCustomBlend.unity.meta index 1abac9289..236e8983f 100644 --- a/com.unity.cinemachine/Samples~/3D Samples/Custom Blends/Custom Blends.unity.meta +++ b/com.unity.cinemachine/Samples~/3D Samples/EarlyLookAtCustomBlend.unity.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 22ec0824fa2148c4a998c6a40d8d6a81 +guid: 94248086d638fc941b256c4632768b67 DefaultImporter: externalObjects: {} userData: diff --git a/com.unity.cinemachine/Samples~/3D Samples/PerspectiveToOrthoCustomBlend.unity b/com.unity.cinemachine/Samples~/3D Samples/PerspectiveToOrthoCustomBlend.unity new file mode 100644 index 000000000..0a594c69a --- /dev/null +++ b/com.unity.cinemachine/Samples~/3D Samples/PerspectiveToOrthoCustomBlend.unity @@ -0,0 +1,788 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 10 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 13 + m_BakeOnSceneLoad: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 1 + m_PVRFilteringGaussRadiusAO: 1 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1001 &76645379 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2451271811042757136, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6668015293666917239, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + propertyPath: HelpText + value: 'This scene shows how to implement a custom blend algorithm - in this + case we are blending between perspective and orthographic cameras, which + is not natively supported by Cinemachine. + + + Because it''s not possible + to lerp between perspective and ortho cameras, we approximate the ortho camera + with a perspective camera placed far away with a small fov, and blend to + that. Afterwards, we simply cut to the ortho camera. + + + The implementation + is in the PerspectiveToOrthoCustomBlender on the Custom Blender object. + It hooks into Cinemachine''s blend creation, and overrides the default blend + algorithm when it detects blending between perspective and orthographic cameras. + + + If + you disable the Custom Blender object, you will see what the default blend + looks like.' + objectReference: {fileID: 0} + - target: {fileID: 9138370430051789472, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} + propertyPath: m_Name + value: HelpUI + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: d7425ed2047e64d8ea6ff79f20bd46f6, type: 3} +--- !u!1 &231738875 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 231738877} + - component: {fileID: 231738876} + - component: {fileID: 231738878} + m_Layer: 0 + m_Name: Ortho Camera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &231738876 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 231738875} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f9dfa5b682dcd46bda6128250e975f58, type: 3} + m_Name: + m_EditorClassIdentifier: + Priority: + Enabled: 0 + m_Value: 0 + OutputChannel: 1 + StandbyUpdate: 2 + m_StreamingVersion: 20241001 + m_LegacyPriority: 0 + Target: + TrackingTarget: {fileID: 1953522864} + LookAtTarget: {fileID: 0} + CustomLookAtTarget: 0 + Lens: + FieldOfView: 60.000004 + OrthographicSize: 8 + NearClipPlane: 0.3 + FarClipPlane: 1000 + Dutch: 0 + ModeOverride: 1 + PhysicalProperties: + GateFit: 2 + SensorSize: {x: 21.946, y: 16.002} + LensShift: {x: 0, y: 0} + FocusDistance: 10 + Iso: 200 + ShutterSpeed: 0.005 + Aperture: 16 + BladeCount: 5 + Curvature: {x: 2, y: 11} + BarrelClipping: 0.25 + Anamorphism: 0 + BlendHint: 0 +--- !u!4 &231738877 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 231738875} + serializedVersion: 2 + m_LocalRotation: {x: 0.35355338, y: 0.35355338, z: -0.1464466, w: 0.8535535} + m_LocalPosition: {x: -74.99999, y: 107.06601, z: -75} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 45, y: 45, z: 0} +--- !u!114 &231738878 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 231738875} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 886251e9a18ece04ea8e61686c173e1b, type: 3} + m_Name: + m_EditorClassIdentifier: + CameraDistance: 150 + DeadZoneDepth: 0 + Composition: + ScreenPosition: {x: 0, y: 0} + DeadZone: + Enabled: 0 + Size: {x: 0.2, y: 0.2} + HardLimits: + Enabled: 0 + Size: {x: 0.8, y: 0.8} + Offset: {x: 0, y: 0} + CenterOnActivate: 1 + TargetOffset: {x: 0, y: 1, z: 0} + Damping: {x: 1, y: 1, z: 1} + Lookahead: + Enabled: 0 + Time: 0 + Smoothing: 0 + IgnoreY: 0 +--- !u!1 &411855492 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 411855495} + - component: {fileID: 411855494} + - component: {fileID: 411855493} + - component: {fileID: 411855496} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &411855493 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 411855492} + m_Enabled: 1 +--- !u!20 &411855494 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 411855492} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60.000004 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &411855495 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 411855492} + serializedVersion: 2 + m_LocalRotation: {x: 0.079244465, y: 0.0000000014762096, z: -1.1735049e-10, w: 0.9968552} + m_LocalPosition: {x: 0, y: 1.8, z: -5} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &411855496 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 411855492} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 72ece51f2901e7445ab60da3685d6b5f, type: 3} + m_Name: + m_EditorClassIdentifier: + ShowDebugText: 0 + ShowCameraFrustum: 1 + IgnoreTimeScale: 0 + WorldUpOverride: {fileID: 0} + ChannelMask: -1 + UpdateMethod: 2 + BlendUpdateMethod: 1 + LensModeOverride: + Enabled: 1 + DefaultMode: 2 + DefaultBlend: + Style: 1 + Time: 2 + CustomCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + CustomBlends: {fileID: 0} +--- !u!1 &439102519 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 439102521} + - component: {fileID: 439102520} + m_Layer: 0 + m_Name: Custom Blender + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &439102520 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 439102519} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 51f0a49e6b834fa47872db1fbc7bcbdb, type: 3} + m_Name: + m_EditorClassIdentifier: + FakeOrthoCameraDistance: 500 +--- !u!4 &439102521 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 439102519} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 4.6212006, y: 3.7886658, z: -14.817954} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &987944639 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4436525663902916665, guid: c97e1248c10cd3549b3d18c1eb1c3722, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4436525663902916665, guid: c97e1248c10cd3549b3d18c1eb1c3722, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4436525663902916665, guid: c97e1248c10cd3549b3d18c1eb1c3722, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4436525663902916665, guid: c97e1248c10cd3549b3d18c1eb1c3722, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4436525663902916665, guid: c97e1248c10cd3549b3d18c1eb1c3722, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4436525663902916665, guid: c97e1248c10cd3549b3d18c1eb1c3722, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4436525663902916665, guid: c97e1248c10cd3549b3d18c1eb1c3722, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4436525663902916665, guid: c97e1248c10cd3549b3d18c1eb1c3722, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4436525663902916665, guid: c97e1248c10cd3549b3d18c1eb1c3722, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4436525663902916665, guid: c97e1248c10cd3549b3d18c1eb1c3722, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4436525663902916670, guid: c97e1248c10cd3549b3d18c1eb1c3722, type: 3} + propertyPath: m_Name + value: Checkerboard Stage + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: c97e1248c10cd3549b3d18c1eb1c3722, type: 3} +--- !u!1 &1361464459 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1361464461} + - component: {fileID: 1361464460} + m_Layer: 0 + m_Name: Timeline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!320 &1361464460 +PlayableDirector: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1361464459} + m_Enabled: 1 + serializedVersion: 3 + m_PlayableAsset: {fileID: 11400000, guid: eec34a9ce0d0359438a83abe0aa3d43c, type: 2} + m_InitialState: 1 + m_WrapMode: 1 + m_DirectorUpdateMode: 1 + m_InitialTime: 0 + m_SceneBindings: + - key: {fileID: -7601557799249459473, guid: eec34a9ce0d0359438a83abe0aa3d43c, type: 2} + value: {fileID: 411855496} + m_ExposedReferences: + m_References: + - ffac4a85744d8be489b571759dce9260: {fileID: 231738876} + - 01cd9f2b7e7988c4fa4273367eb05978: {fileID: 2043783997} + - 3c5a81e5250d1bd4c8ed94bd8ab5ff73: {fileID: 2043783997} +--- !u!4 &1361464461 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1361464459} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 4.6212006, y: 3.7886658, z: -14.817954} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &1953522863 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 3521509573382385251, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + propertyPath: m_Name + value: Player + objectReference: {fileID: 0} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} +--- !u!4 &1953522864 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 4293402553517372633, guid: 4d8d7a9a98d3f4ac2967d48094ea010f, type: 3} + m_PrefabInstance: {fileID: 1953522863} + m_PrefabAsset: {fileID: 0} +--- !u!1 &2043783994 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2043783998} + - component: {fileID: 2043783997} + - component: {fileID: 2043783996} + - component: {fileID: 2043783995} + m_Layer: 0 + m_Name: Perspective Camera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2043783995 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2043783994} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f38bda98361e1de48a4ca2bd86ea3c17, type: 3} + m_Name: + m_EditorClassIdentifier: + Composition: + ScreenPosition: {x: 0, y: 0} + DeadZone: + Enabled: 0 + Size: {x: 0.2, y: 0.2} + HardLimits: + Enabled: 0 + Size: {x: 0.8, y: 0.8} + Offset: {x: 0, y: 0} + CenterOnActivate: 1 + TargetOffset: {x: 0, y: 1, z: 0} + Damping: {x: 0.5, y: 0.5} + Lookahead: + Enabled: 0 + Time: 0 + Smoothing: 0 + IgnoreY: 0 +--- !u!114 &2043783996 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2043783994} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b617507da6d07e749b7efdb34e1173e1, type: 3} + m_Name: + m_EditorClassIdentifier: + TrackerSettings: + BindingMode: 4 + PositionDamping: {x: 1, y: 1, z: 1} + AngularDampingMode: 0 + RotationDamping: {x: 1, y: 1, z: 1} + QuaternionDamping: 1 + FollowOffset: {x: 0, y: 1.8, z: -5} +--- !u!114 &2043783997 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2043783994} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f9dfa5b682dcd46bda6128250e975f58, type: 3} + m_Name: + m_EditorClassIdentifier: + Priority: + Enabled: 0 + m_Value: 0 + OutputChannel: 1 + StandbyUpdate: 2 + m_StreamingVersion: 20241001 + m_LegacyPriority: 0 + Target: + TrackingTarget: {fileID: 1953522864} + LookAtTarget: {fileID: 0} + CustomLookAtTarget: 0 + Lens: + FieldOfView: 60.000004 + OrthographicSize: 5 + NearClipPlane: 0.3 + FarClipPlane: 1000 + Dutch: 0 + ModeOverride: 2 + PhysicalProperties: + GateFit: 2 + SensorSize: {x: 21.946, y: 16.002} + LensShift: {x: 0, y: 0} + FocusDistance: 10 + Iso: 200 + ShutterSpeed: 0.005 + Aperture: 16 + BladeCount: 5 + Curvature: {x: 2, y: 11} + BarrelClipping: 0.25 + Anamorphism: 0 + BlendHint: 0 +--- !u!4 &2043783998 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2043783994} + serializedVersion: 2 + m_LocalRotation: {x: 0.079244465, y: 0.0000000014762096, z: -1.1735049e-10, w: 0.9968552} + m_LocalPosition: {x: 0, y: 1.8, z: -5} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 411855495} + - {fileID: 76645379} + - {fileID: 987944639} + - {fileID: 1953522863} + - {fileID: 2043783998} + - {fileID: 231738877} + - {fileID: 439102521} + - {fileID: 1361464461} diff --git a/com.unity.cinemachine/Samples~/3D Samples/Custom Blends.meta b/com.unity.cinemachine/Samples~/3D Samples/PerspectiveToOrthoCustomBlend.unity.meta similarity index 67% rename from com.unity.cinemachine/Samples~/3D Samples/Custom Blends.meta rename to com.unity.cinemachine/Samples~/3D Samples/PerspectiveToOrthoCustomBlend.unity.meta index 02c8818c8..13a1fff66 100644 --- a/com.unity.cinemachine/Samples~/3D Samples/Custom Blends.meta +++ b/com.unity.cinemachine/Samples~/3D Samples/PerspectiveToOrthoCustomBlend.unity.meta @@ -1,6 +1,5 @@ fileFormatVersion: 2 -guid: 15666cb7409cfe544b467a00e568a453 -folderAsset: yes +guid: 1dee4a973cb5fa64fae8fe879447f36a DefaultImporter: externalObjects: {} userData: diff --git a/com.unity.cinemachine/Samples~/Shared Assets/Scripts/EarlyLookAtCustomBlender.cs b/com.unity.cinemachine/Samples~/Shared Assets/Scripts/EarlyLookAtCustomBlender.cs new file mode 100644 index 000000000..e58e66dcc --- /dev/null +++ b/com.unity.cinemachine/Samples~/Shared Assets/Scripts/EarlyLookAtCustomBlender.cs @@ -0,0 +1,72 @@ +using UnityEngine; + +namespace Unity.Cinemachine.Samples +{ + public class EarlyLookAtCustomBlender : MonoBehaviour, CinemachineBlend.IBlender + { + // CinemachineBlend.IBlender implementation: + // This method is free to blend the states any way it likes. + // In this case, we do a default blend then override the rotation to make + // it happen at the beginning of the blend. + public CameraState GetIntermediateState(ICinemachineCamera CamA, ICinemachineCamera CamB, float t) + { + var stateA = CamA.State; + var stateB = CamB.State; + + // Standard blend - first we disable cylindrical position + stateA.BlendHint &= ~CameraState.BlendHints.CylindricalPositionBlend; + stateB.BlendHint &= ~CameraState.BlendHints.CylindricalPositionBlend; + var state = CameraState.Lerp(stateA, stateB, t); + + // Override the rotation blend: look directly at the new target + // at the start of the blend + const float kFinishRotatingAt = 0.2f; + var rotB = Quaternion.LookRotation( + stateB.ReferenceLookAt - state.RawPosition, state.ReferenceUp); + state.RawOrientation = Quaternion.Slerp( + stateA.RawOrientation, rotB, Damper.Damp(1, kFinishRotatingAt, t)); + + return state; + } + + void OnEnable() => CinemachineCore.GetCustomBlender += GetCustomBlender; + void OnDisable() => CinemachineCore.GetCustomBlender -= GetCustomBlender; + + // CinemachineCore.GetCustomBlender handler + CinemachineBlend.IBlender GetCustomBlender(ICinemachineCamera camA, ICinemachineCamera camB) + { + // Override the blender with a custom blender if the game state demands it + if (m_UseCustomBlend) + return this; + + // Use default blender + return null; + } + + // The remainder of this code is demo-specific implementation + + bool m_UseCustomBlend; + + // Callback for UX button + public void DefaultBlend() + { + m_UseCustomBlend = false; + ChangeCamera(); + } + + // Callback for UX button + public void CustomBlend() + { + m_UseCustomBlend = true; + ChangeCamera(); + } + + void ChangeCamera() + { + // Cycle through all the virtual cameras, assuming that they all have the same priority. + // Prioritize the least-recently used one. + int numCameras = CinemachineCore.VirtualCameraCount; + CinemachineCore.GetVirtualCamera(numCameras - 1).Prioritize(); + } + } +} \ No newline at end of file diff --git a/com.unity.cinemachine/Samples~/3D Samples/Custom Blends/BlendStyleManager.cs.meta b/com.unity.cinemachine/Samples~/Shared Assets/Scripts/EarlyLookAtCustomBlender.cs.meta similarity index 100% rename from com.unity.cinemachine/Samples~/3D Samples/Custom Blends/BlendStyleManager.cs.meta rename to com.unity.cinemachine/Samples~/Shared Assets/Scripts/EarlyLookAtCustomBlender.cs.meta diff --git a/com.unity.cinemachine/Samples~/Shared Assets/Scripts/PerspectiveToOrthoCustomBlender.cs b/com.unity.cinemachine/Samples~/Shared Assets/Scripts/PerspectiveToOrthoCustomBlender.cs new file mode 100644 index 000000000..7ac5d2526 --- /dev/null +++ b/com.unity.cinemachine/Samples~/Shared Assets/Scripts/PerspectiveToOrthoCustomBlender.cs @@ -0,0 +1,110 @@ +using UnityEngine; + +namespace Unity.Cinemachine.Samples +{ + /// + /// This behaviour implements a custom algorithm to provide smooth blends between perspective + /// and ortho cameras. Drop it into your scene, and while enabled it will override the default + /// blending algorithms when appropriate. + /// + /// Specifically, if one camera is perspective and the other is orthographic, and if the orthographic + /// camera has a LookAt target, the custom blend will be used. + /// + /// Because it's not possible to lerp between perspective and ortho cameras, we approximate the ortho + /// camera with a perspective camera placed far away with a small fov, and blend to that. Afterwards, + /// we simply cut to the ortho camera. + /// + /// This class illustrates the use of the CinemachineCore.GetCustomBlender hook, and shows how to + /// implement the CinemachineBlend.IBlender interface. + /// + [ExecuteAlways] + public class PerspectiveToOrthoCustomBlender : MonoBehaviour, CinemachineBlend.IBlender + { + [Tooltip("Minimum distance at which to place the perspective camera which will mimic the orthographic one. \n" + + "Changing this distance may affect the feel of the blend: a large distance will produce a better approximation " + + "of the ortho camera, but will also make the FOV change happen more quickly at the start of the blend. \n" + + "Keep this ditance as small as you can tolerate, to avoid precision errors which can be present at " + + "large camera distances.")] + public float FakeOrthoCameraDistance = 100; + + void OnEnable() => CinemachineCore.GetCustomBlender += GetCustomBlender; + void OnDisable() => CinemachineCore.GetCustomBlender -= GetCustomBlender; + + // CinemachineCore.GetCustomBlender handler + CinemachineBlend.IBlender GetCustomBlender(ICinemachineCamera camA, ICinemachineCamera camB) + { + // Use the custom blender if and only if we're transitioning between ortho and perspective cameras + if (camA != null && camB != null) + { + var stateA = camA.State; + var stateB = camB.State; + if (IsBlendToOrthoCandidate(ref stateA, ref stateB)) + return this; + } + // Use default blender + return null; + } + + // CinemachineBlend.IBlender implementation + public CameraState GetIntermediateState(ICinemachineCamera camA, ICinemachineCamera camB, float t) + { + var stateA = camA.State; + var stateB = camB.State; + + // This can happen if we're blending intermediate states due to interrupted blend + if (!IsBlendToOrthoCandidate(ref stateA, ref stateB)) + return CameraState.Lerp(stateA, stateB, t); + + if (!stateA.Lens.Orthographic) + return BlendToOrtho(ref stateA, ref stateB, t); + + return BlendToOrtho(ref stateB, ref stateA, 1-t); + } + + bool IsBlendToOrthoCandidate(ref CameraState stateA, ref CameraState stateB) + { + bool orthoA = stateA.Lens.Orthographic; + bool orthoB = stateB.Lens.Orthographic; + + // A lookAt target is required on the ortho camera in order to establish the mimic fov + return orthoA != orthoB && ((orthoA && stateA.HasLookAt()) || (orthoB && stateB.HasLookAt())); + } + + // Replaces stateB with a fake ortho camera which is a far-away perspective camera with a small fov + CameraState BlendToOrtho(ref CameraState stateA, ref CameraState stateB, float t) + { + var lensB = stateB.Lens; + var orthoSize = lensB.OrthographicSize; + + var lookAt = stateB.ReferenceLookAt; + if (!stateA.HasLookAt()) + stateA.ReferenceLookAt = lookAt; + + var distanceFromTarget = Vector3.Distance(lookAt, stateB.GetCorrectedPosition()); + + // We want it to be far compared to the ortho size + var extraDistance = Mathf.Max(0, Mathf.Max(FakeOrthoCameraDistance, orthoSize * 20) - distanceFromTarget); + + var rotB = stateB.GetFinalOrientation(); + stateB.RawPosition = stateB.GetCorrectedPosition() + rotB * Vector3.back * extraDistance; + stateB.PositionCorrection = Vector3.zero; + stateB.ReferenceUp = rotB * Vector3.up; + + // Force a spherical position algorithm + stateB.BlendHint |= CameraState.BlendHints.SphericalPositionBlend; + + // The fov should be such as to produce the ortho size at the target's position + var lens = stateA.Lens; + lens.FieldOfView = 2f * Mathf.Atan(orthoSize / (extraDistance + distanceFromTarget)) * Mathf.Rad2Deg; + + // Lerp the clip planes to reduce popping + lens.NearClipPlane = Mathf.Max(lens.NearClipPlane, extraDistance + lensB.NearClipPlane); + lens.FarClipPlane = extraDistance + lensB.FarClipPlane; + stateB.Lens = lens; + + // We square t to spend more time at the start of the blend, producing a smoother result + // when the fake ortho camera is far away. This could potentially be tweaked. + return CameraState.Lerp(stateA, stateB, t * t); + } + } +} diff --git a/com.unity.cinemachine/Samples~/Shared Assets/Scripts/PerspectiveToOrthoCustomBlender.cs.meta b/com.unity.cinemachine/Samples~/Shared Assets/Scripts/PerspectiveToOrthoCustomBlender.cs.meta new file mode 100644 index 000000000..2090bead2 --- /dev/null +++ b/com.unity.cinemachine/Samples~/Shared Assets/Scripts/PerspectiveToOrthoCustomBlender.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 51f0a49e6b834fa47872db1fbc7bcbdb \ No newline at end of file diff --git a/com.unity.cinemachine/Samples~/Shared Assets/Timelines/AlternatingCamerasTimeline.playable b/com.unity.cinemachine/Samples~/Shared Assets/Timelines/AlternatingCamerasTimeline.playable new file mode 100644 index 000000000..e492b95b7 --- /dev/null +++ b/com.unity.cinemachine/Samples~/Shared Assets/Timelines/AlternatingCamerasTimeline.playable @@ -0,0 +1,302 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-7601557799249459473 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 05acc715f855ced458d76ee6f8ac6c61, type: 3} + m_Name: Cinemachine Track + m_EditorClassIdentifier: + m_Version: 3 + m_AnimClip: {fileID: 0} + m_Locked: 0 + m_Muted: 0 + m_CustomPlayableFullTypename: + m_Curves: {fileID: 0} + m_Parent: {fileID: 11400000} + m_Children: [] + m_Clips: + - m_Version: 1 + m_Start: 0 + m_ClipIn: 0 + m_Asset: {fileID: 4594059848158499293} + m_Duration: 1.5166666666666666 + m_TimeScale: 1 + m_ParentTrack: {fileID: -7601557799249459473} + m_EaseInDuration: 0 + m_EaseOutDuration: 0 + m_BlendInDuration: -1 + m_BlendOutDuration: 0.7166666666666666 + m_MixInCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_MixOutCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BlendInCurveMode: 0 + m_BlendOutCurveMode: 0 + m_ExposedParameterNames: [] + m_AnimationCurves: {fileID: 0} + m_Recordable: 0 + m_PostExtrapolationMode: 0 + m_PreExtrapolationMode: 0 + m_PostExtrapolationTime: 0 + m_PreExtrapolationTime: 0 + m_DisplayName: CinemachineCamera + - m_Version: 1 + m_Start: 0.8 + m_ClipIn: 0 + m_Asset: {fileID: -2998236905059015376} + m_Duration: 2.249999999999999 + m_TimeScale: 1 + m_ParentTrack: {fileID: -7601557799249459473} + m_EaseInDuration: 0 + m_EaseOutDuration: 0 + m_BlendInDuration: 0.7166666666666666 + m_BlendOutDuration: 0.7333333333333321 + m_MixInCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_MixOutCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BlendInCurveMode: 0 + m_BlendOutCurveMode: 0 + m_ExposedParameterNames: [] + m_AnimationCurves: {fileID: 0} + m_Recordable: 0 + m_PostExtrapolationMode: 0 + m_PreExtrapolationMode: 0 + m_PostExtrapolationTime: 0 + m_PreExtrapolationTime: 0 + m_DisplayName: Ortho Top View Camera + - m_Version: 1 + m_Start: 2.316666666666667 + m_ClipIn: 0 + m_Asset: {fileID: -3550593309180061191} + m_Duration: 1.0499999999999998 + m_TimeScale: 1 + m_ParentTrack: {fileID: -7601557799249459473} + m_EaseInDuration: 0 + m_EaseOutDuration: 0 + m_BlendInDuration: 0.7333333333333321 + m_BlendOutDuration: -1 + m_MixInCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_MixOutCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BlendInCurveMode: 0 + m_BlendOutCurveMode: 0 + m_ExposedParameterNames: [] + m_AnimationCurves: {fileID: 0} + m_Recordable: 0 + m_PostExtrapolationMode: 0 + m_PreExtrapolationMode: 0 + m_PostExtrapolationTime: 0 + m_PreExtrapolationTime: 0 + m_DisplayName: CinemachineCamera + m_Markers: + m_Objects: [] + TrackPriority: 0 +--- !u!114 &-3550593309180061191 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90fb794a295e73545af71bcdb7375791, type: 3} + m_Name: CinemachineShot + m_EditorClassIdentifier: + DisplayName: + VirtualCamera: + exposedName: 3c5a81e5250d1bd4c8ed94bd8ab5ff73 + defaultValue: {fileID: 0} +--- !u!114 &-2998236905059015376 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90fb794a295e73545af71bcdb7375791, type: 3} + m_Name: CinemachineShot + m_EditorClassIdentifier: + DisplayName: + VirtualCamera: + exposedName: ffac4a85744d8be489b571759dce9260 + defaultValue: {fileID: 0} +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bfda56da833e2384a9677cd3c976a436, type: 3} + m_Name: AlternatingCamerasTimeline + m_EditorClassIdentifier: + m_Version: 0 + m_Tracks: + - {fileID: -7601557799249459473} + m_FixedDuration: 0 + m_EditorSettings: + m_Framerate: 60 + m_ScenePreview: 1 + m_DurationMode: 0 + m_MarkerTrack: {fileID: 0} +--- !u!114 &4594059848158499293 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90fb794a295e73545af71bcdb7375791, type: 3} + m_Name: CinemachineShot + m_EditorClassIdentifier: + DisplayName: + VirtualCamera: + exposedName: 01cd9f2b7e7988c4fa4273367eb05978 + defaultValue: {fileID: 0} diff --git a/com.unity.cinemachine/Samples~/Shared Assets/Timelines/AlternatingCamerasTimeline.playable.meta b/com.unity.cinemachine/Samples~/Shared Assets/Timelines/AlternatingCamerasTimeline.playable.meta new file mode 100644 index 000000000..babb9c5b5 --- /dev/null +++ b/com.unity.cinemachine/Samples~/Shared Assets/Timelines/AlternatingCamerasTimeline.playable.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eec34a9ce0d0359438a83abe0aa3d43c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.cinemachine/Samples~/Shared Assets/UI/SamplesUIStyle.uss b/com.unity.cinemachine/Samples~/Shared Assets/UI/SamplesUIStyle.uss index 5e9e7c465..0b1555354 100644 --- a/com.unity.cinemachine/Samples~/Shared Assets/UI/SamplesUIStyle.uss +++ b/com.unity.cinemachine/Samples~/Shared Assets/UI/SamplesUIStyle.uss @@ -38,8 +38,8 @@ Box { position: absolute; top: 5%; bottom: auto; - left: 10%; - right: 10%; + left: 20%; + right: 20%; max-height: 80%; justify-content: space-between; } From 07666d420aae950146427defa703465e170531a3 Mon Sep 17 00:00:00 2001 From: Gregory Labute Date: Wed, 10 Sep 2025 16:47:49 -0400 Subject: [PATCH 2/9] Add doc for customizing blends --- .../ControllingAndCustomizingBlends.md | 41 +++++++++++++++++++ .../Documentation~/TableOfContents.md | 1 + .../Documentation~/samples-tutorials.md | 3 +- 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 com.unity.cinemachine/Documentation~/ControllingAndCustomizingBlends.md diff --git a/com.unity.cinemachine/Documentation~/ControllingAndCustomizingBlends.md b/com.unity.cinemachine/Documentation~/ControllingAndCustomizingBlends.md new file mode 100644 index 000000000..93f0b4081 --- /dev/null +++ b/com.unity.cinemachine/Documentation~/ControllingAndCustomizingBlends.md @@ -0,0 +1,41 @@ +# Controlling and Customizing Blends + +Cinemachine offers a number of ways to control how one camera blends to another when the active camera changes. The easiest and most common ways involve setting up assets to define rules about how to blend between specific cameras or families of cameras. + +For more advanced users, it's possible to drive blend styles based on game events or other dynamic criteria, and even to customize the blend algorithm itself - but these techniques will require some custom coding. + +## Default Blend + +The most basic strategy is to set up a Default Blend in the CinemachineBrain. This blend setting will be used for all blends which are not covered by more specific settings and rules. + +Default Blend is available in the Cinemachine Brain, and in Cinemachine Manager Cameras which control a set of child cameras (such as ClearShot, StateDrivenCamera, etc). + +## BlenderSettings Asset + +All Cinemachine components having a Default Blend setting also have a Custom Blends setting which holds a BlenderSettings asset. This asset contains a list of blend settings to apply when blending between cameras with specific names. With it, you can control how individual cameras blend to other cameras by setting their blend curves and blend durations. Cameras which are not covered by specific rules listed here will be picked up by the default blend. + +## Timeline Shot Overlapping + +Independently of Default Blend and Blender Settings assets, the Timeline also controls blends which are made by overlapping Cinemachine Shots on the Timeline's Cinemachine Track. When blends are created this way, they are explicitly controlled by Timeline, and are not affected by the other blend control settings. The blend duration is determined by the overlap size, and the blend curve is controlled by the easing curves specified in the Cinemachine Shot (which by default are ease-in-ease-out). + +Note that this precise control is obtained only when overlapping Cinemachine Shots. If you use Activation Tracks in Timeline to activate and deactivate Cinemachine Cameras, then the standard blending controls (Default Blend and Blender Settings) will apply for those blends. + +## `CinemachineCore.BlendCreatedEvent` + +Every time a blend is created by Cinemachine, an event is fired giving you a chance to override the settings of that blend based on arbitrary dynamic criteria. + +If you install a handler for this event (perhaps by using the CinemachineBrainEvents class), then your handler can check things like game context and decide either to allow the blend to remain as-is, or to override such things as blend style, blend duration, or blend algorithm. + +This is an advanced technique and requires scripting to implement the event handler. + +Note that this event is NOT fired for blends created by overlapping Timeline Shots. This is because there is an expectation that Timeline precisely controls the blending, and this cannot be overridden. + +## `CinemachineCore.GetCustomBlender` + +The most advanced level of control is customizing the blend algorithm itself. Cinemachine has a sophisticated algorithm for lerping camera states (`CameraState.Lerp()`), which interpoltes position, rotation, lens settings, and other attributes while taking into account blend hints and the screen position of the lookAt target. + +These things are all lerped at the same rate, so position, rotation, and lens all change together. You may have a situation where you want the rotation to happen first, or the position to follow a path, or some other requirement not handled natively by Cinemachine. + +In this case, your recourse is to author a custom blender, which implements the `CinemachineBlend.IBlender` interface. You can provide Cinemachine with this blender by hooking into the `CinemachineCore.GetCustomBlender` delegate. Cinemachine will call this whenever a blend is created - even from Timeline. You can check the cameras to be blended and whatever other state you like, and either provide a custom blender or returen null for the default one. + +Cinemachine comes with two sample scenes - `Early LookAt Custom Blend` and `Perspective To Ortho Custom Blend` which illustrate this technique. Coding profficiency is required. diff --git a/com.unity.cinemachine/Documentation~/TableOfContents.md b/com.unity.cinemachine/Documentation~/TableOfContents.md index 54ddbbfe0..7b21fdba0 100644 --- a/com.unity.cinemachine/Documentation~/TableOfContents.md +++ b/com.unity.cinemachine/Documentation~/TableOfContents.md @@ -36,6 +36,7 @@ * [Filtering impulses](CinemachineImpulseFiltering.md) * [Split screen and multiple Unity Cameras](CinemachineMultipleCameras.md) * [Use Input System with Cinemachine](InputSystemComponents.md) +* [Controlling and Customizing Blends](ControllingAndCustomizingBlends.md) * [Samples and tutorials](samples-tutorials.md) * [Import samples to your project](samples-import.md) * [Simple Player Controller](SimplePlayerController.md) diff --git a/com.unity.cinemachine/Documentation~/samples-tutorials.md b/com.unity.cinemachine/Documentation~/samples-tutorials.md index 1bead2bb9..b6e581c5e 100644 --- a/com.unity.cinemachine/Documentation~/samples-tutorials.md +++ b/com.unity.cinemachine/Documentation~/samples-tutorials.md @@ -24,14 +24,15 @@ Once you import the 3D Samples set, the following scenes are available in the `A | :--- | :--- | | **Brain Update Modes** | | | **Clear Shot** | | -| **Custom Blends** | | | **Cutscene** | | +| **Early LookAt Custom Blend** | | | **Fly around** |