public static float Angle (Quaternion a, Quaternion b);

描述

返回两个旋转 ab 之间的角度(以度为单位)。

示例:请考虑两个 GameObject(A 和 B)围绕第三个 GameObject (C) 移动的情况。从 C 到 A 和从 C 到 B 的线构成一个随时间变化的三角形。CA 和 CB 之间的角度为 Quaternion.Angle 提供的值。

using UnityEngine;
using System.Collections;

// Calculates the angle (degrees) between // the rotation of this transform and target.

public class ExampleClass : MonoBehaviour { public Transform target;

void Update() { float angle = Quaternion.Angle(transform.rotation, target.rotation); } }