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

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Quaternion.operator *

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

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

Parameters

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

Description

lhslhs の回転を組合わせます。

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

no example available in JavaScript
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 operator *(rotation: Quaternion, point: Vector3): Vector3;
public static Vector3 operator *(Quaternion rotation, Vector3 point);

Parameters

Description

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

no example available in JavaScript
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; } }