Scripting API: Quaternion.w - Unity - Manual
Maybe your like
- Manual
- Scripting API
- unity.com
- Supported
- Legacy
- English
- C#
Scripting API
Version: Unity 6.3 LTS Select a different version LanguageEnglish- English
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.
CloseSubmission 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* Submit suggestionCancel
Switch to Manual public float w;Description
W component of the Quaternion. Do not directly modify quaternions.
using System.Collections; using System.Collections.Generic; using UnityEngine;// Quaternion-w script example // Create a Sphere and apply a texture to help the orientation be recognised. // At each second the sphere is rotated and the quaternion is displayed.public class ExampleClass : MonoBehaviour { private float timeDelay = 0.0f; private Quaternion q; private string label = ""; void Awake() { // Add a line that passes through the y axis of the sphere and make // the line as a child. GameObject line = GameObject.CreatePrimitive(PrimitiveType.Cube); line.transform.localScale = new Vector3(0.05f, 1.5f, 0.05f); line.transform.parent = gameObject.transform; } void Update() { if (timeDelay > 1.0f) { Vector3 v; // generate a random euler angle v.x = Random.Range(0.0f, 360.0f); v.y = Random.Range(0.0f, 360.0f); v.z = Random.Range(0.0f, 360.0f); // convert the euler into a quaternion q = Quaternion.Euler(v); // and apply it to the sphere transform.rotation = q; // generate a string label = q.ToString("f3"); // and start another 1 second delay timeDelay = 0.0f; } timeDelay += Time.deltaTime; } // display the quaternion as a string void OnGUI() { GUI.skin.label.fixedHeight = 40; GUI.skin.label.fontSize = 24; GUI.Label(new Rect(10, 10, 400, 30), label); } }Is something described here not working as you expect it to? It might be a Known Issue. Please check with the Issue Tracker at issuetracker.unity3d.com.
Copyright ©2005-2025 Unity Technologies. All rights reserved. Built from: 6000.3.3f1 (c1aa93182893). Built on: 2025-12-11. Tutorials Community Answers Knowledge Base Forums Asset Store Terms of use Legal Privacy Policy Cookies Do Not Sell or Share My Personal Information Your Privacy Choices (Cookie Settings)Tag » What Is A Quaternion Unity
-
Scripting API: Quaternion - Unity - Manual
-
C# Quaternions In Unity! - Intermediate Scripting Tutorial - YouTube
-
Please Explain Quaternions! - Unity Answers
-
Quaternions - Unity Learn
-
Unity Quaternion And Rotation Guide For Beginners - VionixStudio
-
[유니티 기초] - Quaternion - 네이버 블로그
-
Unity Quaternions For Dummies - WireWhiz
-
Quaternions In Unity - Medium
-
Manual: Rotation And Orientation In Unity
-
[Unity] 오브젝트의 회전에 대하여(Rotation, Quaternion, Euler)
-
Unity - Rotated Objects Flips In A Strange Way When Using Quaternions
-
Unity Rotate Quaternion - Dynamic'Action
-
Could Some One Explain Me A Little Bit More A Bout Quaternion In ...
-
What Are Quaternions In Unity 3D? How Does One Explain It ... - Quora