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

Project on Direction#

Math / Project on Direction

  • Can Read

  • Cannot Write

Description#

Projects a vector onto another direction vector

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]
    
    [Title("Project on Direction")]
    [Category("Math/Project on Direction")]
    [Description("Projects a vector onto another direction vector")]
    
    [Image(typeof(IconProjection), ColorTheme.Type.Yellow)]
    [Keywords("Vector")]
    
    [Serializable]
    public class TypeVector3MathProjectOnDirection : TypeVector3
    {
        [SerializeField] private GetVector3 m_Vector = new GetVector3();
        [SerializeField] private GetVector3 m_Direction = new GetVector3();

        public override Vector3 GetPreview(GameObject source) =>
            Vector3.Project(
                this.m_Vector.GetPreview(source),
                this.m_Direction.GetPreview(source)
            );

        public override Vector3 Get(Args args)
        {
            return Vector3.Project(
                this.m_Vector.Get(args),
                this.m_Direction.Get(args)
            );
        }
        
        public override string ToString()
        {
            return $"Project {this.m_Vector} on {this.m_Direction}";
        }
        
        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.