Mathf
- Abs
- Acos
- Approximately
- Asin
- Atan2
- Atan
- CeilToInt
- Ceil
- Clamp01
- Clamp
- ClosestPowerOfTwo
- Cos
- Deg2Rad
- DeltaAngle
- Epsilon
- Exp
- FloorToInt
- Floor
- Infinity
- InverseLerp
- IsPowerOfTwo
- LerpAngle
- Lerp
- Log10
- Log
- Max
- Min
- MoveTowardsAngle
- MoveTowards
- NegativeInfinity
- NextPowerOfTwo
- PingPong
- PI
- Pow
- Rad2Deg
- Repeat
- RoundToInt
- Round
- Sign
- Sin
- SmoothDampAngle
- SmoothDamp
- SmoothStep
- Sqrt
- Tan
Mathf.Clamp01 限制0~1
static function Clamp01 (value : float) : float
Description描述
Clamps value between 0 and 1 and returns value
限制value在0,1之间并返回value。如果value小于0,返回0。如果value大于1,返回1,否则返回value 。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void Update() {
transform.position = new Vector3(Mathf.Clamp01(Time.time), 0, 0);
}
}
最后修改:2011年2月23日 Wednesday 14:03