Random.insideUnitSphere 单位球内

static var insideUnitSphere : Vector3

Description描述

Returns a random point inside a sphere with radius 1 (Read Only).

返回半径为1的球体内的一个随机点。(只读)

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		transform.position = Random.insideUnitSphere * 5;
	}
}
// Sets the position to be somewhere inside a sphere
// with radius 5 and the center at zero.
//设置位置到半径为5的球体内的某个地方,并且中心为0

transform.position = Random.insideUnitSphere * 5;
Page last updated: 2011-1-19