浏览代码

control timeline speed instead of path speed

/cinematic-demo-ME
etienne cella 5 年前
当前提交
0d5cc5b5
共有 4 个文件被更改,包括 60 次插入395 次删除
  1. 380
      Assets/Scenes/Demo/Demo.unity
  2. 39
      Assets/ClusterDisplay/Scripts/DirectorController.cs
  3. 36
      Assets/ClusterDisplay/Scripts/DollyController.cs
  4. 0
      /Assets/ClusterDisplay/Scripts/DirectorController.cs.meta

380
Assets/Scenes/Demo/Demo.unity


- {fileID: 1367818372}
- {fileID: 1413143611}
- {fileID: 1963778101}
- {fileID: 1415043722}
- {fileID: 264422018}
- {fileID: 1957780957}
m_Father: {fileID: 0}
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

m_Name:
m_EditorClassIdentifier:
Name: ResetVolumetricsAction
--- !u!1 &264422017
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 264422018}
- component: {fileID: 264422019}
m_Layer: 0
m_Name: DollyTrack3
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &264422018
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 264422017}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 2.17}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 109962325}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &264422019
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 264422017}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a200b19ca1a9685429ed7e043c28e904, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Resolution: 20
m_Appearance:
pathColor: {r: 0, g: 1, b: 0, a: 1}
inactivePathColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
width: 0.2
m_Looped: 0
m_Waypoints:
- position: {x: 1, y: 0, z: 0}
roll: 0
- position: {x: 2, y: 0, z: -4.226403}
roll: 0
- position: {x: 7.857173, y: 0, z: 0}
roll: 0
--- !u!1 &287699778
GameObject:
m_ObjectHideFlags: 0

roll: 0
- position: {x: -38.776688, y: -3.4867525, z: -47.001366}
roll: 0
--- !u!1 &1415043721
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1415043722}
- component: {fileID: 1415043723}
m_Layer: 0
m_Name: DollyTrack2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &1415043722
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1415043721}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -0.13}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 109962325}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1415043723
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1415043721}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a200b19ca1a9685429ed7e043c28e904, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Resolution: 20
m_Appearance:
pathColor: {r: 0, g: 1, b: 0, a: 1}
inactivePathColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
width: 0.2
m_Looped: 0
m_Waypoints:
- position: {x: 1, y: 0, z: 0}
roll: 0
- position: {x: 2, y: 0, z: -4.226403}
roll: 0
- position: {x: 3.597803, y: 0, z: 0}
roll: 0
--- !u!43 &1452773266
Mesh:
m_ObjectHideFlags: 0

m_Component:
- component: {fileID: 1692219631}
- component: {fileID: 1692219632}
- component: {fileID: 1692219633}
m_Layer: 0
m_Name: Timeline cart driver
m_TagString: Untagged

m_IsActive: 0
m_IsActive: 1
--- !u!4 &1692219631
Transform:
m_ObjectHideFlags: 0

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 109962325}
m_RootOrder: 5
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!320 &1692219632
PlayableDirector:

m_InitialTime: 0
m_SceneBindings:
- key: {fileID: -4878163679587137354, guid: 5e39f607d08b95148be44fb50062293f, type: 2}
value: {fileID: 1957780953}
value: {fileID: 0}
- key: {fileID: 4627053967029438951, guid: 5e39f607d08b95148be44fb50062293f, type: 2}
value: {fileID: 1963778099}
- key: {fileID: -5447609427781532511, guid: 5e39f607d08b95148be44fb50062293f, type: 2}

- 287d853d61b681f4d8261b2f0ecc8b4e: {fileID: 1367818373}
--- !u!114 &1692219633
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1692219630}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1a49aa03c779a7b4e992c853226ec40e, type: 3}
m_Name:
m_EditorClassIdentifier:
m_MaxSpeed: 2
m_MinSpeed: 0
m_SpeedDelta: 0.1
--- !u!1 &1711691666
GameObject:
m_ObjectHideFlags: 0

m_Father: {fileID: 1537333773}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1957780952
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1957780957}
- component: {fileID: 1957780956}
- component: {fileID: 1957780955}
- component: {fileID: 1957780954}
- component: {fileID: 1957780953}
m_Layer: 0
m_Name: Camera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!114 &1957780953
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1957780952}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 72ece51f2901e7445ab60da3685d6b5f, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ShowDebugText: 1
m_ShowCameraFrustum: 1
m_IgnoreTimeScale: 0
m_WorldUpOverride: {fileID: 0}
m_UpdateMethod: 2
m_BlendUpdateMethod: 1
m_DefaultBlend:
m_Style: 1
m_Time: 2
m_CustomCurve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_CustomBlends: {fileID: 0}
m_CameraCutEvent:
m_PersistentCalls:
m_Calls: []
m_CameraActivatedEvent:
m_PersistentCalls:
m_Calls: []
--- !u!114 &1957780954
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1957780952}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 23c1ce4fb46143f46bc5cb5224c934f6, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Version: 7
m_ObsoleteRenderingPath: 0
m_ObsoleteFrameSettings:
overrides: 0
enableShadow: 0
enableContactShadows: 0
enableShadowMask: 0
enableSSR: 0
enableSSAO: 0
enableSubsurfaceScattering: 0
enableTransmission: 0
enableAtmosphericScattering: 0
enableVolumetrics: 0
enableReprojectionForVolumetrics: 0
enableLightLayers: 0
enableExposureControl: 1
diffuseGlobalDimmer: 0
specularGlobalDimmer: 0
shaderLitMode: 0
enableDepthPrepassWithDeferredRendering: 0
enableTransparentPrepass: 0
enableMotionVectors: 0
enableObjectMotionVectors: 0
enableDecals: 0
enableRoughRefraction: 0
enableTransparentPostpass: 0
enableDistortion: 0
enablePostprocess: 0
enableOpaqueObjects: 0
enableTransparentObjects: 0
enableRealtimePlanarReflection: 0
enableMSAA: 0
enableAsyncCompute: 0
runLightListAsync: 0
runSSRAsync: 0
runSSAOAsync: 0
runContactShadowsAsync: 0
runVolumeVoxelizationAsync: 0
lightLoopSettings:
overrides: 0
enableDeferredTileAndCluster: 0
enableComputeLightEvaluation: 0
enableComputeLightVariants: 0
enableComputeMaterialVariants: 0
enableFptlForForwardOpaque: 0
enableBigTilePrepass: 0
isFptlEnabled: 0
clearColorMode: 0
backgroundColorHDR: {r: 0.025, g: 0.07, b: 0.19, a: 0}
clearDepth: 1
volumeLayerMask:
serializedVersion: 2
m_Bits: 4294967295
volumeAnchorOverride: {fileID: 0}
antialiasing: 0
SMAAQuality: 2
dithering: 0
stopNaNs: 0
taaSharpenStrength: 0.6
physicalParameters:
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
flipYMode: 0
fullscreenPassthrough: 0
allowDynamicResolution: 0
customRenderingSettings: 0
invertFaceCulling: 0
probeLayerMask:
serializedVersion: 2
m_Bits: 4294967295
hasPersistentHistory: 0
m_RenderingPathCustomFrameSettings:
bitDatas:
data1: 70280697347917
data2: 4539628424926265344
lodBias: 1
lodBiasMode: 0
lodBiasQualityLevel: 0
maximumLODLevel: 0
maximumLODLevelMode: 0
maximumLODLevelQualityLevel: 0
materialQuality: 0
renderingPathCustomFrameSettingsOverrideMask:
mask:
data1: 0
data2: 0
defaultFrameSettings: 0
--- !u!81 &1957780955
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1957780952}
m_Enabled: 1
--- !u!20 &1957780956
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1957780952}
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_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 33.793205
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.1
far clip plane: 5000
field of view: 40
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_AllowMSAA: 0
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1957780957
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1957780952}
m_LocalRotation: {x: 0, y: 0.7262475, z: 0, w: 0.6874333}
m_LocalPosition: {x: -23.117512, y: 8.381705, z: -35.445152}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 109962325}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1963778098
GameObject:
m_ObjectHideFlags: 0

- component: {fileID: 1963778101}
- component: {fileID: 1963778099}
- component: {fileID: 1963778100}
- component: {fileID: 1963778102}
m_Layer: 0
m_Name: DollyCart1
m_TagString: Untagged

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1963778098}
m_LocalRotation: {x: -0.018706951, y: 0.7540966, z: 0.021499597, w: 0.65614486}
m_LocalPosition: {x: -30.837025, y: -3.3809624, z: -53.206177}
m_LocalRotation: {x: -0.0035444584, y: 0.5882334, z: 0.0025782397, w: 0.8086794}
m_LocalPosition: {x: -19.464884, y: -2.8918009, z: -51.713142}
--- !u!114 &1963778102
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1963778098}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1a49aa03c779a7b4e992c853226ec40e, type: 3}
m_Name:
m_EditorClassIdentifier:
m_MaxSpeed: 2
m_MinSpeed: 0
m_SpeedDeltaPerFrame: 0.01
--- !u!1 &2007101360
GameObject:
m_ObjectHideFlags: 0

39
Assets/ClusterDisplay/Scripts/DirectorController.cs


using System;
using UnityEngine;
using UnityEngine.Playables;
[RequireComponent(typeof(PlayableDirector))]
public class DirectorController : MonoBehaviour
{
[SerializeField]
float m_MaxSpeed;
[SerializeField]
float m_MinSpeed;
[SerializeField]
float m_SpeedDelta;
PlayableDirector m_Director;
float m_Speed;
void OnEnable()
{
m_Director = GetComponent<PlayableDirector>();
m_Director.RebuildGraph();
m_Speed = Mathf.Clamp(1, m_MinSpeed, m_MaxSpeed);
m_Director.playableGraph.GetRootPlayable(0).SetSpeed(m_Speed);
}
void Update()
{
var delta = 0;
if (Input.GetKey(KeyCode.DownArrow))
delta = -1;
else if (Input.GetKey(KeyCode.UpArrow))
delta = 1;
m_Speed = Mathf.Clamp(m_Speed + delta * m_SpeedDelta, m_MinSpeed, m_MaxSpeed);
m_Director.playableGraph.GetRootPlayable(0).SetSpeed(m_Speed);
}
}

36
Assets/ClusterDisplay/Scripts/DollyController.cs


using System;
using Cinemachine;
using UnityEngine;
[RequireComponent(typeof(CinemachineDollyCart))]
public class DollyController : MonoBehaviour
{
[SerializeField]
float m_MaxSpeed;
[SerializeField]
float m_MinSpeed;
[SerializeField]
float m_SpeedDeltaPerFrame;
CinemachineDollyCart m_TrackedDolly;
void OnEnable()
{
m_TrackedDolly = GetComponent<CinemachineDollyCart>();
m_TrackedDolly.m_Position = 0;
m_TrackedDolly.m_Speed = Mathf.Clamp(m_TrackedDolly.m_Speed, m_MinSpeed, m_MaxSpeed);
}
void Update()
{
var delta = 0;
if (Input.GetKey(KeyCode.DownArrow))
delta = -1;
else if (Input.GetKey(KeyCode.UpArrow))
delta = 1;
m_TrackedDolly.m_Speed = Mathf.Clamp(m_TrackedDolly.m_Speed + delta * m_SpeedDeltaPerFrame, m_MinSpeed, m_MaxSpeed);
}
}

/Assets/ClusterDisplay/Scripts/DollyController.cs.meta → /Assets/ClusterDisplay/Scripts/DirectorController.cs.meta

正在加载...
取消
保存