A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.unity3d.com/Manual/../ScriptReference/Quaternion.ToAngleAxis.html below:

Unity - Scripting API: Quaternion.ToAngleAxis

Quaternion.ToAngleAxis 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 Submission failed

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

Close Your name Your email Suggestion*

Cancel

Switch to Manual Declaration

public void

ToAngleAxis

(out float

angle

, out

Vector3 axis

);

Parameters Parameter Description angle The rotation angle in degrees. The value is in the range [0, 360]. axis The axis of rotation as a normalized Vector3. If the quaternion represents no rotation, the axis defaults to Vector3.right. Description

Converts a rotation to angle-axis representation.

This method decomposes the quaternion into an angle (in degrees) and a unit vector representing the axis of rotation. Normalize the quaternion before calling this method, otherwise Unity throws an exception.

using UnityEngine;

public class Example : MonoBehaviour { void Start() { // Extracts the angle - axis from euler angle rotation Quaternion rotation = Quaternion.Euler(0, 90, 0); rotation.ToAngleAxis(out float angle, out Vector3 axis); // angle is 90 // axis is (0, 1, 0)

// Extracts the angle - axis rotation from the transform rotation float transformRotationAngle = 0.0f; Vector3 transformRotationAxis = Vector3.zero; transform.rotation.ToAngleAxis(out transformRotationAngle, out transformRotationAxis); } }


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4