1,创建FreeLook相机,点击Add选择collider相机,再选择Listienerxian相机,再创建一个球挂天上,给球挂载CinemachineCollisionImpulseSource脚本,震动就实现了
2,创建一个相机轨迹,给相机轨迹添加三个点形成圆,然后给相机加一个速度,相机轨迹完成
3,创建FreeLook相机,点击Add选择collider相机,再创建一个cube,调整cube大小,相机会跟着玩家、
代码如下:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;
using UnityEngine.EventSystems;
public class CameraMgr : MonoBehaviour,IDragHandler
{
public CinemachineFreeLook cfl;
public void OnDrag(PointerEventData eventData)
{
cfl.m_XAxis.Value += eventData.delta.x;
cfl.m_YAxis.Value += eventData.delta.y/Screen.height;
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}