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.Sign 符号
static function Sign (f : float) : float
Description描述
Returns the sign of f.
返回 f 的符号。
Return value is 1 when f is positive or zero, -1 when f is negative.
当 f 为正或为0返回1,为负返回-1。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public void Awake() {
Debug.Log(Mathf.Sign(-10));
Debug.Log(Mathf.Sign(10));
}
}
最后修改:2011年2月23日 Wednesday 13:46