docs.unity3d.com
    Show / Hide Table of Contents

    Dot Product

    Menu Path : Operator > Math > Vector

    The Dot Product uniform Operator performs a dot-product between two input vectors and outputs the result.

    This operator is useful for numerous purposes which include:

    • To compute the squared length of a given vector. To do this, connect the same vector to both input ports.
    • To determine whether two normalized vectors point in the same direction. This returns 1.0 if the vectors point in the same direction, 0.0 if they are perpendicular, and -1.0 if they point in opposite directions.
    • To project a vector A on a normalized vector B and return its projected length along B.

    Operator properties

    Input Type Description
    A Configurable The first vector of the dot product.
    B Configurable The second vector of the dot product.
    Output Type Description
    Output float The result of the dot product.
    The Type changes to match the type of A and B.

    Operator configuration

    To view this uniform Operator's configuration, click the cog icon in the Node's header. Here you can configure the data type this Operator uses.

    Available types

    You can use the following types for your Input values and ports:

    • Position
    • Vector
    • Direction
    • Vector3
    • Vector2
    In This Article
    • Operator properties
    • Operator configuration
      • Available types
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023