Random.onUnitSphere 单位球上

static var onUnitSphere : Vector3

Description描述

Returns a random point on the surface of a sphere with radius 1 (Read Only).

返回半径为1的球体在表面上的一个随机点。(只读)

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		rigidbody.velocity = Random.onUnitSphere * 10;
	}
}
// Sets the rigidbody velocity to 10 and in a random direction.
//设置刚体速度到10并且在一个随机方向

rigidbody.velocity = Random.onUnitSphere * 10;
Page last updated: 2011-1-19