Random.rotation 旋转角度

static var rotation : Quaternion

Description描述

Returns a random rotation (Read Only).

返回一个随机旋转角度。(只读)

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public GameObject prefab;
	public void Awake() {
		Instantiate(prefab, Vector3.zero, Random.rotation);
	}
}
// Instantiates a prefab with a random rotation at the world-origin
//实例化一个预设,并带有随机旋转,在世界原点

var prefab : GameObject;
Instantiate(prefab, Vector3.zero, Random.rotation);
Page last updated: 2011-1-19