Mathf.Abs 绝对值

static function Abs (f : float) : float

Description描述

Returns the absolute value of f.

计算并返回指定参数 f 绝对值。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		print(Mathf.Abs(-10.5F));
	}
}
// prints 10.5
print(Mathf.Abs(-10.5));

•static function Abs (value : int) : int

Description描述

Returns the absolute value of value.

计算并返回指定参数value绝对值。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		print(Mathf.Abs(-10));
	}
}
// prints 10
print(Mathf.Abs(-10));
Page last updated: 2011-2-22