言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

Transform.Rotate

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public function Rotate(eulerAngles: Vector3, relativeTo: Space = Space.Self): void;
public void Rotate(Vector3 eulerAngles, Space relativeTo = Space.Self);
public def Rotate(eulerAngles as Vector3, relativeTo as Space = Space.Self) as void

Description

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

/relativeTo/ を設定しない、またはSpace.Selfを設定した場合は回転はTransformのローカル軸で適用されます。(シーンビュー内でオブジェクトを選択している時に見えているX,Y,Z軸) /relativeTo/ がSpace.Worldの場合、回転はワールドのX,Y,Z軸で適用されます。

	function Update() {
		// Slowly rotate the object around its X axis at 1 degree/second.
		transform.Rotate(Vector3.right * Time.deltaTime);

		// ... at the same time as spinning relative to the global 
		// Y axis at the same speed.
		transform.Rotate(Vector3.up * Time.deltaTime, Space.World);
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Update() {
        transform.Rotate(Vector3.right * Time.deltaTime);
        transform.Rotate(Vector3.up * Time.deltaTime, Space.World);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Update() as void:
		transform.Rotate((Vector3.right * Time.deltaTime))
		transform.Rotate((Vector3.up * Time.deltaTime), Space.World)

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

Description

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

/relativeTo/ を設定しない、またはSpace.Selfを設定した場合は回転はTransformのローカル軸で適用されます。(シーンビュー内でオブジェクトを選択している時に見えているX,Y,Z軸) /relativeTo/ がSpace.Worldの場合、回転はワールドのX,Y,Z軸で適用されます。

	function Update() {
		// Slowly rotate the object around its X axis at 1 degree/second.
		transform.Rotate(Time.deltaTime, 0, 0);

		// ... at the same time as spinning it relative to the global 
		// Y axis at the same speed.
		transform.Rotate(0, Time.deltaTime, 0, Space.World);
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Update() {
        transform.Rotate(Time.deltaTime, 0, 0);
        transform.Rotate(0, Time.deltaTime, 0, Space.World);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Update() as void:
		transform.Rotate(Time.deltaTime, 0, 0)
		transform.Rotate(0, Time.deltaTime, 0, Space.World)

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

Description

指定した軸(angle)で angle 度回転させます

/relativeTo/ を設定しない、またはSpace.Selfを設定した場合は軸( axis )はTransformのローカル軸で適用されます。(シーンビュー内でオブジェクトを選択している時に見えているX,Y,Z軸) /relativeTo/ がSpace.Worldの場合、 axis パラメータはワールドのX,Y,Z軸で適用されます。

	function Update() {
		// Slowly rotate the object around its X axis at 1 degree/second.
		transform.Rotate(Vector3.right, Time.deltaTime);

		// ... at the same time as spinning it relative to the global 
		// Y axis at the same speed.
		transform.Rotate(Vector3.up, Time.deltaTime, Space.World);
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Update() {
        transform.Rotate(Vector3.right, Time.deltaTime);
        transform.Rotate(Vector3.up, Time.deltaTime, Space.World);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Update() as void:
		transform.Rotate(Vector3.right, Time.deltaTime)
		transform.Rotate(Vector3.up, Time.deltaTime, Space.World)