Legacy Documentation: Version 5.0
Language: English
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Mathf.InverseLerp

Switch to Manual
public static function InverseLerp(from: float, to: float, value: float): float;

Parameters

Description

Calculates the Lerp parameter between of two values.

	var walkSpeed = 5.0;
	var runSpeed = 10.0;
	var speed = 8.0;

function Start() { // parameter is now 3 / 5 var parameter : float = Mathf.InverseLerp(walkSpeed, runSpeed, speed); }