文档

Unity Engine

Unity Engine

AngleAxis

Creates a rotation which rotates angle degrees around axis.
阅读时间1 分钟最后更新于 1 个月前

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule

AngleAxis(float, Vector3)

Creates a rotation which rotates
angle
degrees around
axis
.
public static Quaternion AngleAxis(float angle, Vector3 axis)

Parameters

angle


Returns

Type

Description

Quaternion

Remarks

The rotation is counter-clockwise when looking from the origin along the axis of rotation. For more information, refer to Controlling rotation with the Quaternion class. The magnitude of the axis parameter is not applied.

Examples

using UnityEngine;public class Example : MonoBehaviour{ void Start() { // Sets the transform's current rotation to a new rotation that rotates 30 degrees around the y-axis(Vector3.up) transform.rotation = Quaternion.AngleAxis(30, Vector3.up); }}

AngleAxis(float, Vector3)

Creates a rotation which rotates
angle
degrees around
axis
.
public static Quaternion AngleAxis(float angle, in Vector3 axis)

Parameters

angle


Returns

Type

Description

Quaternion

Remarks

The rotation is counter-clockwise when looking from the origin along the axis of rotation. For more information, refer to Controlling rotation with the Quaternion class. The magnitude of the axis parameter is not applied.

Examples

using UnityEngine;public class Example : MonoBehaviour{ void Start() { // Sets the transform's current rotation to a new rotation that rotates 30 degrees around the y-axis(Vector3.up) transform.rotation = Quaternion.AngleAxis(30, Vector3.up); }}