Version: Unity 6.5 Alpha (6000.5)
LanguageEnglish
  • C#

math.faceforward

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static float2 faceforward(float2 n, float2 i, float2 ng);

Parameters

Parameter Description
n Vector to conditionally flip.
i First vector in direction comparison.
ng Second vector in direction comparison.

Returns

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

Description

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

Parameter Description
n Vector to conditionally flip.
i First vector in direction comparison.
ng Second vector in direction comparison.

Returns

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

Description

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

Parameter Description
n Vector to conditionally flip.
i First vector in direction comparison.
ng Second vector in direction comparison.

Returns

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

Description

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

Parameter Description
n Vector to conditionally flip.
i First vector in direction comparison.
ng Second vector in direction comparison.

Returns

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

Description

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

Parameter Description
n Vector to conditionally flip.
i First vector in direction comparison.
ng Second vector in direction comparison.

Returns

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

Description

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

Parameter Description
n Vector to conditionally flip.
i First vector in direction comparison.
ng Second vector in direction comparison.

Returns

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

Description

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.