我正在制作一个带有钟摆的安卓游戏,当在统一播放模式下,钟摆的运动是平滑的但是在电话中过渡滞后并且不平滑。下面是我使用的代码。
float angle = 35;
public float speed;
Quaternion qStart, qEnd;
void Start () {
qStart = Quaternion.AngleAxis ( angle, Vector3.forward);
qEnd = Quaternion.AngleAxis (-angle, Vector3.forward);
speed = 1.5f;
}
void Update () {
transform.rotation = Quaternion.Lerp (qStart, qEnd, (Mathf.Sin(Time.time * speed) + 1.0f) / 2.0f);
if(Time.timeScale == 0)
transform.rotation = Quaternion.Euler(0,0,0);
}