关键功能:
1、摄影机跟随船体移动
2、船体在水面上晃动
3、摇杆控制方向
船在水面上晃动的原理其实就是船体围绕着Z轴和X轴旋转一个小的角度,然后在恢复回来,然后在旋转的一个小过程
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Shake : MonoBehaviour
{
// 绕Z轴的摇摆的速度
float z_Speed = 3.0f;
// 绕X轴的摇摆的速度
float x_Speed = 1.0f;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
// 绕Z轴摇晃
if(this.transform.eulerAngles.z >= 4 && this.transform.