【问题标题】:Change Camera shoulder Offset of Cinemachine in script在脚本中更改 Cinemachine 的相机肩部偏移
【发布时间】:2022-11-24 04:29:01
【问题描述】:

enter image description here

您想知道如何在脚本中更改 Cinemachine 摄像机肩部偏移!

【问题讨论】:

    标签: unity3d


    【解决方案1】:

    您必须从 CinemachineVirtualCamera 获取适当的组件并在其上设置值。类似的东西(假设它在 MonoBehaviour 中):

    [SerializeField] private CinemachineVirtualCamera _virtualCamera;
    
    private Cinemachine3rdPersonFollow _3rdPersonFollow;
    
    private void Start()
    {
        _3rdPersonFollow = _virtualCamera.GetCinemachineComponent<Cinemachine3rdPersonFollow>();
    }
    
    private void SomeMethodOfYoursWhatChangesShoulderOffset()
    {
        _3rdPersonFollow.ShoulderOffset = new(x, y, z);
    }
    

    与其他组件相同,如:CinemachineTransposer(身体)、CinemachineBasicMultiChannelPerlin(噪音)等。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-15
      • 2022-11-12
      • 2022-01-12
      • 1970-01-01
      • 1970-01-01
      • 2021-04-05
      相关资源
      最近更新 更多