Random.insideUnitCircle 单位圆内
static var insideUnitCircle : Vector2
Description描述
Returns a random point inside a circle with radius 1 (Read Only).
返回半径为1的圆内的一个随机点。(只读)
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Vector2 newPosition = Random.insideUnitCircle * 5;
public void Awake() {
transform.position.x = newPosition.x;
transform.position.y = newPosition.y;
}
}
// Sets the position to be somewhere inside a circle
// with radius 5 and the center at zero.
//设置位置到圆内的某个地方并且中心点为0
var newPosition : Vector2 = Random.insideUnitCircle * 5;
transform.position.x = newPosition.x;
transform.position.y = newPosition.y;
最后修改:2011年1月19日 Wednesday 16:04