unity cinemachine 围绕follow的物体旋转
需要按QE旋转摄像机视角,物体不动摄像机旋转,我写的代码物体也会跟随的动。怎样才能实现人不动,摄像机围绕人旋转?用的摄像机是Virtual Camera
我的错误代码:
public class rotates : MonoBehaviour
{
// Start is called before the first frame update
// Update is called once per frame
void Update()
{
Vector3 inputDir = new Vector3(0, 0, 0);
float rotateDir = 0f;
if (Input.GetKey(KeyCode.Q))
{
rotateDir = +1f;
}
if (Input.GetKey(KeyCode.E))
{
rotateDir = -1f;
}
float rotateSpeed = 100f;
transform.eulerAngles += new Vector3(0, rotateDir * rotateSpeed * Time.deltaTime, 0);
}
}
###### 我觉得应该修改的是虚拟相机的x轴的body属性的Follow Offset值