Version: 2017.4
public void Rotate (Vector3 eulerAngles, Space relativeTo= Space.Self);

パラメーター

relativeTo回転はオブジェクトに対してローカルか、ワールド
eulers適用する回転

説明

Z 軸で eulerAngles.z 度回転、X 軸で eulerAngles.x 度回転、Y 軸で eulerAngles.y 度回転します (順番は説明した順)

If relativeTo is not specified or set to Space.Self the rotation is applied around the transform's local axes. If relativeTo is set to Space.World the rotation is applied around the world x, y, z axes.

using UnityEngine;

public class ExampleClass : MonoBehaviour { void Update() { // Rotate the object around its local X axis at 1 degree per second transform.Rotate(Vector3.right * Time.deltaTime);

// ...also rotate around the World's Y axis transform.Rotate(Vector3.up * Time.deltaTime, Space.World); } }

public void Rotate (float xAngle, float yAngle, float zAngle, Space relativeTo= Space.Self);

パラメーター

xAngleX 軸の周りで回転する角度
yAngleY 軸の周りで回転する角度
zAngleZ 軸の周りで回転する角度
relativeTo回転はオブジェクトに対してローカルか、ワールド

説明

Z 軸で zAngle 度回転、X 軸で xAngle 度回転、Y 軸で yAngle 度回転します (順番は説明した順)

If relativeTo is not specified or set to Space.Self the rotation is applied around the transform's local axes. If relativeTo is set to Space.World the rotation is applied around the world x, y, z axes.

using UnityEngine;

public class ExampleClass : MonoBehaviour { void Update() { // Rotate the object around its local X axis at 1 degree per second transform.Rotate(Time.deltaTime, 0, 0);

// ...also rotate around the World's Y axis transform.Rotate(0, Time.deltaTime, 0, Space.World); } }

public void Rotate (Vector3 axis, float angle, Space relativeTo= Space.Self);

パラメーター

axis回転を適用する軸
angle適用する回転角度
relativeTo回転はオブジェクトに対してローカルか、ワールド

説明

axis 軸の周りに angle 度、回転します。

If relativeTo is not specified or set to Space.Self the rotation is applied around the transform's local axes. If relativeTo is set to Space.World the rotation is applied around the world x, y, z axes.

using UnityEngine;

public class ExampleClass : MonoBehaviour { void Update() { // Rotate the object around its local X axis at 1 degree per second transform.Rotate(Vector3.right, Time.deltaTime);

// ...also rotate around the World's Y axis transform.Rotate(Vector3.up, Time.deltaTime, Space.World); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961