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

Absolute#

Math / Absolute

  • Can Read

  • Cannot Write

Description#

Removes the sign of every component of a vector, making them all positive

Parameters#

Name Description
Vector The vector whose components lose their sign

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

    [Title("Absolute")]
    [Category("Math/Absolute")]

    [Description("Removes the sign of every component of a vector, making them all positive")]
    [Image(typeof(IconAbsolute), ColorTheme.Type.Yellow)]

    [Parameter("Vector", "The vector whose components lose their sign")]

    [Keywords("Vector", "Positive", "Sign", "Magnitude", "Abs")]

    [Serializable]
    public class TypeVector2MathAbsolute : TypeVector2
    {
        [SerializeField] private GetVector2 m_Vector = new GetVector2();

        public override Vector2 GetPreview(GameObject source) => Absolute(this.m_Vector.GetPreview(source));

        public override Vector2 Get(Args args) => Absolute(this.m_Vector.Get(args));

        private static Vector2 Absolute(Vector2 vector)
        {
            return new Vector2(Mathf.Abs(vector.x), Mathf.Abs(vector.y));
        }

        public override string ToString()
        {
            return $"Abs({this.m_Vector})";
        }

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