Transform.localRotation 自身旋转角度

var localRotation : Quaternion

Description描述

The rotation of the transform relative to the parent transform's rotation.

物体变换的旋转角度相对于父级的物体变换的旋转角度。

Unity stores rotations as Quaternions internally. To rotate an object, use Transform.Rotate. Use Transform.localEulerAngles for modifying the rotation as euler angles.

Untiy作为四元数内部储存旋转角度。旋转一个物体,使用Transform.Rotate,使用Transform.localEulerAngles为设置作为欧拉角的旋转角度。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		transform.localRotation = Quaternion.identity;
	}
}
// Set the rotation to be the same as the parent
//设置旋转角度同父级一样。
transform.localRotation = Quaternion.identity;
最后修改:2010年12月18日 Saturday 23:39

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。