Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


faceforward

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.
Read time 2 minutesLast updated 6 days ago

Definition

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.
public static float2 faceforward(float2 n, float2 i, float2 ng)

Parameters

Vector to conditionally flip.

First vector in direction comparison.

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.
public static float3 faceforward(float3 n, float3 i, float3 ng)

Parameters

Vector to conditionally flip.

First vector in direction comparison.

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.
public static float4 faceforward(float4 n, float4 i, float4 ng)

Parameters

Vector to conditionally flip.

First vector in direction comparison.

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.
public static double2 faceforward(double2 n, double2 i, double2 ng)

Parameters

Vector to conditionally flip.

First vector in direction comparison.

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.
public static double3 faceforward(double3 n, double3 i, double3 ng)

Parameters

Vector to conditionally flip.

First vector in direction comparison.

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.
public static double4 faceforward(double4 n, double4 i, double4 ng)

Parameters

Vector to conditionally flip.

First vector in direction comparison.

Second vector in direction comparison.

Returns

Type

Description

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