public static float InverseLerp (float a, float b, float value);

描述

计算在范围 [a, b] 内生成插值 value 的线性参数 t。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public float walkSpeed = 5.0F; public float runSpeed = 10.0F; public float speed = 8.0F; void Start() { float parameter = Mathf.InverseLerp(walkSpeed, runSpeed, speed); } }

另请参阅:Lerp