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

Rotate Towards#

Math / Rotate Towards

  • Can Read

  • Cannot Write

Description#

Rotates a vector current towards target

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]
    
    [Title("Rotate Towards")]
    [Category("Math/Rotate Towards")]
    [Description("Rotates a vector current towards target")]
    
    [Image(typeof(IconQuaternion), ColorTheme.Type.Yellow, typeof(BadgeArrowRight))]
    [Keywords("Vector")]
    
    [Serializable]
    public class TypeVector3MathRotateTowards : TypeVector3
    {
        [SerializeField] private GetVector3 m_Current = new GetVector3();
        [SerializeField] private GetVector3 m_Target = new GetVector3();
        
        [SerializeField] private GetNumber m_MaxRadiansDelta = new GetNumber();
        [SerializeField] private GetNumber m_MaxMagnitudeDelta = new GetNumber();
        
        public override Vector3 Get(Args args)
        {
            return Vector3.RotateTowards(
                this.m_Current.Get(args),
                this.m_Target.Get(args),
                (float) this.m_MaxRadiansDelta.Get(args),
                (float) this.m_MaxMagnitudeDelta.Get(args)
            );
        }
        
        public override string ToString()
        {
            return $"Rotate from {this.m_Current} towards {m_Target}";
        }
        
        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.