docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method faceforward

    faceforward(float2, float2, float2)

    Conditionally flips a vector n if two vectors i and ng are pointing in the same direction. Returns n if dot(i, ng) < 0, -n otherwise.

    Declaration
    public static float2 faceforward(float2 n, float2 i, float2 ng)
    Parameters
    Type Name Description
    float2 n

    Vector to conditionally flip.

    float2 i

    First vector in direction comparison.

    float2 ng

    Second vector in direction comparison.

    Returns
    Type Description
    float2

    -n if i and ng point in the same direction; otherwise return n unchanged.

    faceforward(float3, float3, float3)

    Conditionally flips a vector n if two vectors i and ng are pointing in the same direction. Returns n if dot(i, ng) < 0, -n otherwise.

    Declaration
    public static float3 faceforward(float3 n, float3 i, float3 ng)
    Parameters
    Type Name Description
    float3 n

    Vector to conditionally flip.

    float3 i

    First vector in direction comparison.

    float3 ng

    Second vector in direction comparison.

    Returns
    Type Description
    float3

    -n if i and ng point in the same direction; otherwise return n unchanged.

    faceforward(float4, float4, float4)

    Conditionally flips a vector n if two vectors i and ng are pointing in the same direction. Returns n if dot(i, ng) < 0, -n otherwise.

    Declaration
    public static float4 faceforward(float4 n, float4 i, float4 ng)
    Parameters
    Type Name Description
    float4 n

    Vector to conditionally flip.

    float4 i

    First vector in direction comparison.

    float4 ng

    Second vector in direction comparison.

    Returns
    Type Description
    float4

    -n if i and ng point in the same direction; otherwise return n unchanged.

    faceforward(double2, double2, double2)

    Conditionally flips a vector n if two vectors i and ng are pointing in the same direction. Returns n if dot(i, ng) < 0, -n otherwise.

    Declaration
    public static double2 faceforward(double2 n, double2 i, double2 ng)
    Parameters
    Type Name Description
    double2 n

    Vector to conditionally flip.

    double2 i

    First vector in direction comparison.

    double2 ng

    Second vector in direction comparison.

    Returns
    Type Description
    double2

    -n if i and ng point in the same direction; otherwise return n unchanged.

    faceforward(double3, double3, double3)

    Conditionally flips a vector n if two vectors i and ng are pointing in the same direction. Returns n if dot(i, ng) < 0, -n otherwise.

    Declaration
    public static double3 faceforward(double3 n, double3 i, double3 ng)
    Parameters
    Type Name Description
    double3 n

    Vector to conditionally flip.

    double3 i

    First vector in direction comparison.

    double3 ng

    Second vector in direction comparison.

    Returns
    Type Description
    double3

    -n if i and ng point in the same direction; otherwise return n unchanged.

    faceforward(double4, double4, double4)

    Conditionally flips a vector n if two vectors i and ng are pointing in the same direction. Returns n if dot(i, ng) < 0, -n otherwise.

    Declaration
    public static double4 faceforward(double4 n, double4 i, double4 ng)
    Parameters
    Type Name Description
    double4 n

    Vector to conditionally flip.

    double4 i

    First vector in direction comparison.

    double4 ng

    Second vector in direction comparison.

    Returns
    Type Description
    double4

    -n if i and ng point in the same direction; otherwise return n unchanged.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)