(cinemachine)尝试在按键时通过路径位置移动履带式移动车

问题描述 投票:0回答:1

我尝试将其设置为当我按EW时,我的相机将穿过我在小车轨道上设置的路点。

当手动增加路径位置时,它可以工作,但是当我尝试编写脚本来执行此操作并调整该值时,由于某种原因,它不允许我将跟踪的小车添加到组件的字段中(它总是显示“无”)。

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

public class Move : MonoBehaviour
{
    public CinemachineTrackedDolly dolly;

    public void OnRotateRight(InputAction.CallbackContext context)
    {
        dolly.m_PathPosition = dolly.m_PathPosition + 1;
    }

    public void OnRotateLeft(InputAction.CallbackContext context)
    {
        dolly.m_PathPosition = dolly.m_PathPosition - 1;
    }
}

my screen

我尝试了许多不同的电影机器模块,但无法弄清楚我做错了什么。我还使用输入系统,以便更轻松地使用不同的按键。

c# unity-game-engine cinemachine
1个回答
0
投票

所以我发现了这个问题。无论出于何种原因,您都无法手动应用要跟踪的 Dolly。您必须通过脚本来完成此操作,并告诉它跟踪的小车是您的相机。

© www.soinside.com 2019 - 2024. All rights reserved.