Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

Quaternion#

Quaternion / Quaternion

  • Can Read

  • Cannot Write

Description#

The Euler angles of a rotation in the specified string format

Parameters#

Name Description
Rotation The rotation value converted to text as its Euler angles
Format The numeric format specifier used for each axis. 'F2' if left empty

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

    [Title("Quaternion")]
    [Category("Quaternion/Quaternion")]

    [Description("The Euler angles of a rotation in the specified string format")]
    [Image(typeof(IconQuaternion), ColorTheme.Type.Lime)]

    [Parameter("Rotation", "The rotation value converted to text as its Euler angles")]
    [Parameter("Format", "The numeric format specifier used for each axis. 'F2' if left empty")]

    [Keywords("Rotation", "Euler", "Angles", "Pitch", "Yaw", "Roll", "Text", "Convert")]

    [Serializable]
    public class TypeStringQuaternionGet : TypeString
    {
        private const string FORMAT = "F2";

        [SerializeField] private GetQuaternion m_Rotation = new GetQuaternion();
        [SerializeField] private string m_Format = FORMAT;

        public override string GetPreview(GameObject source) => Format(
            this.m_Rotation.GetPreview(source),
            this.m_Format
        );

        public override string Get(Args args) => Format(this.m_Rotation.Get(args), this.m_Format);

        private static string Format(Quaternion rotation, string format)
        {
            return rotation.eulerAngles.ToString(string.IsNullOrEmpty(format) ? FORMAT : format);
        }

        public override string ToString()
        {
            return this.m_Rotation.ToString();
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.