Version: 2020.2
public static float LerpAngle (float a, float b, float t);

描述

Lerp 相同,但是在值环绕 360 度时确保值正确插入。

参数 t 限制在范围 [0, 1] 内。假设变量 ab 以度为单位。

using UnityEngine;

public class Example : MonoBehaviour { float minAngle = 0.0f; float maxAngle = 90.0f;

void Update() { float angle = Mathf.LerpAngle(minAngle, maxAngle, Time.time); transform.eulerAngles = new Vector3(0, angle, 0); } }

另请参阅:Lerp