25 lines
827 B
C#
25 lines
827 B
C#
using Unity.Cinemachine;
|
|
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
|
|
namespace SLSUtilities.Cinemachine
|
|
{
|
|
[AddComponentMenu("Cinemachine/Procedural/Extensions/Cinemachine Rotation Offset")]
|
|
[ExecuteAlways]
|
|
[SaveDuringPlay]
|
|
public class CinemachineRotationOffset : CinemachineExtension
|
|
{
|
|
public Vector3 rotationOffset; // 你可以在这里控制 X 和 Y 的抖动
|
|
|
|
protected override void PostPipelineStageCallback(
|
|
CinemachineVirtualCameraBase vcam,
|
|
CinemachineCore.Stage stage, ref CameraState state, float deltaTime)
|
|
{
|
|
// 在最终的 Aim 阶段之后应用偏移
|
|
if (stage == CinemachineCore.Stage.Aim)
|
|
{
|
|
state.RawOrientation *= Quaternion.Euler(rotationOffset);
|
|
}
|
|
}
|
|
}
|
|
} |