Unity利用Cinemachine快速创建游戏中的相机系统

《官方教程》

https://connect.unity.com/p/li-yong-cinemachinekuai-su-chuang-jian-you-xi-zhong-de-xiang-ji-xi-tong

 

《实现震动》

https://www.cnblogs.com/SouthBegonia/p/11891117.html

 

 

Frequency 频率        Amplitude 波幅

 

 

Impact Radius 影响距离

Dissipation Distance 消散距离

 

 

【使用控制Noise组件进行震动】

 
CinemachineVirtualCamera vcam;
CinemachineBasicMultiChannelPerlin noise;
 
void Start() {
        vcam = GameObject.Find("CM vcam1").GetComponent<CinemachineVirtualCamera> ();
        noise = vcam.GetCinemachineComponent<CinemachineBasicMultiChannelPerlin> ();
}
 
public void Noise(float amplitudeGain, float frequencyGain) {
        noise.m_AmplitudeGain = amplitudeGain;
        noise.m_FrequencyGain = frequencyGain;    
}
 

 

posted @ 2020-01-31 13:12  三页菌  阅读(504)  评论(0编辑  收藏  举报