Quaternion.eulerAngles 欧拉角

var eulerAngles : Vector3

Description描述

Returns the euler angle representation of the rotation.

返回表示旋转的欧拉角度。

A rotation that rotates euler.z degrees around the z axis, euler.x degrees around the x axis, and euler.y degrees around the y axis (in that order).

表示旋转的角度,绕z轴旋转euler.z度,绕x轴旋转euler.x度,绕y轴旋转euler.y度(这样的顺序)。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public Quaternion rotation = Quaternion.identity;
	public void Awake() {
		rotation.eulerAngles = new Vector3(0, 30, 0);
		print(rotation.eulerAngles.y);
	}
}
// Create a rotation
//创建一个旋转
var rotation = Quaternion.identity;
// Assign a rotation 30 degrees around the y axis
//绕y轴,指定一个30度旋转角
rotation.eulerAngles = Vector3(0, 30, 0);
// print the rotation around the y-axis
//打印绕y轴的旋转角度
print(rotation.eulerAngles.y);
Page last updated: 2011-1-15