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

Exponential Decay Directions#

Math / Exponential Decay Directions Directions

  • Can Read

  • Cannot Write

Description#

Interpolates a direction value from Current to Target over time

Note

Useful Decay values range between 1 and 25

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]
    
    [Title("Exponential Decay Directions")]
    [Category("Math/Exponential Decay", "Directions")]
    
    [Description("Interpolates a direction value from Current to Target over time")]
    [Image(typeof(IconSnailCat), ColorTheme.Type.Yellow)]
    
    [Keywords("Positive", "Negative", "Symbol")]
    
    [Note("Useful Decay values range between 1 and 25")]
    [Note("Learn more: https://www.youtube.com/watch?v=LSNQuFEDOyQ")]
    
    [Serializable]
    public class TypeVector2MathExponentialDecayDirections : TypeVector2
    {
        [SerializeField] private GetVector2 m_Current = new GetVector2();
        [SerializeField] private GetVector2 m_Target = new GetVector2();
        
        [SerializeField] private GetNumber m_Decay = new GetNumber(16);
        [SerializeField] private GetNumber m_DeltaTime = new GetNumber(
            new TypeNumberTimeDeltaTime()
        );

        public override Vector2 Get(Args args)
        {
            return MathUtils.ExponentialDecayDirection(
                this.m_Current.Get(args), 
                this.m_Target.Get(args), 
                (float) this.m_Decay.Get(args), 
                (float) this.m_DeltaTime.Get(args)
            );
        }

        public override string ToString()
        {
            return $"Smooth to {this.m_Target}";
        }
        
        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.