using System.Collections; using UnityEngine; /// /// 保持平台水平位置 /// public class HorizontalKeep : MonoBehaviour { private void Update() { var theta = Vector3.Dot(transform.forward, Vector3.up); var angle = Mathf.Rad2Deg * theta; transform.Rotate(angle, 0, 0); } }