Version: 2017.3
public Vector3 eulerAngles ;

説明

オイラー角としての角度

The x, y, and z angles represent a rotation z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis.

Only use this variable to read and set the angles to absolute values. Don't increment them, as it will fail when the angle exceeds 360 degrees. Use Transform.Rotate instead.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public float yRotation = 5.0F; void Update() { yRotation += Input.GetAxis("Horizontal"); transform.eulerAngles = new Vector3(10, yRotation, 0); } void Example() { print(transform.eulerAngles.x); print(transform.eulerAngles.y); print(transform.eulerAngles.z); } }

(eulerAngles.x = 10; のように) eulerAngles の一部だけ値を設定することはドリフトと予期せぬ回転につながるのでしないでください。 新しい値を設定するときは、上記のように一度にすべてを設定します。 Unity は Transform.rotation に格納されている回転から角度を変換します。

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961