Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

Quaternion.operator *

マニュアルに切り替える
public static Quaternion operator *(Quaternion lhs, Quaternion rhs);

パラメーター

lhs 左側のクォータ二オン
rhs 右側のクォータ二オン

説明

lhs の回転情報を取得し、それを rhs に適用します。

lhs * rhs の積の値で回転させることは、lhs を最初に、それから rhs というように 2 つの回転を順番に行うことと同じです。つまり、回転は、非可換性で、lhs * rhsrhs * lhs と異なる回転を表すということに気を付けてください。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Transform extraRotation; // Applies the rotation of extraRotation to the current rotation. void Example() { transform.rotation *= extraRotation.rotation; } }

public static Vector3 operator *(Quaternion rotation, Vector3 point);

パラメーター

説明

point の点に rotation の回転をさせます。

using UnityEngine;
using System.Collections;

// Moves the object along relativeDirection // Usually you would use transform.Translate for this public class ExampleClass : MonoBehaviour { public Vector3 relativeDirection = Vector3.forward; void Update() { Vector3 absoluteDirection = transform.rotation * relativeDirection; transform.position += absoluteDirection * Time.deltaTime; } }