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

math.projectsafe

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 projectsafe(float2 a, float2 ontoB, float2 defaultValue);

Parameters

Parameter Description
a Vector to project.
ontoB Non-zero vector to project onto.
defaultValue Default value to return if projection is not finite.

Returns

float2 Vector projection of a onto b or the default value.

Description

Compute vector projection of a onto b. If result is not finite, then return the default value instead.

This function performs extra checks to see if the result of projecting a onto b is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call math.project instead which is faster than this function.


Declaration

public static float3 projectsafe(float3 a, float3 ontoB, float3 defaultValue);

Parameters

Parameter Description
a Vector to project.
ontoB Non-zero vector to project onto.
defaultValue Default value to return if projection is not finite.

Returns

float3 Vector projection of a onto b or the default value.

Description

Compute vector projection of a onto b. If result is not finite, then return the default value instead.

This function performs extra checks to see if the result of projecting a onto b is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call math.project instead which is faster than this function.


Declaration

public static float4 projectsafe(float4 a, float4 ontoB, float4 defaultValue);

Parameters

Parameter Description
a Vector to project.
ontoB Non-zero vector to project onto.
defaultValue Default value to return if projection is not finite.

Returns

float4 Vector projection of a onto b or the default value.

Description

Compute vector projection of a onto b. If result is not finite, then return the default value instead.

This function performs extra checks to see if the result of projecting a onto b is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call math.project instead which is faster than this function.


Declaration

public static double2 projectsafe(double2 a, double2 ontoB, double2 defaultValue);

Parameters

Parameter Description
a Vector to project.
ontoB Non-zero vector to project onto.
defaultValue Default value to return if projection is not finite.

Returns

double2 Vector projection of a onto b or the default value.

Description

Compute vector projection of a onto b. If result is not finite, then return the default value instead.

This function performs extra checks to see if the result of projecting a onto b is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call math.project instead which is faster than this function.


Declaration

public static double3 projectsafe(double3 a, double3 ontoB, double3 defaultValue);

Parameters

Parameter Description
a Vector to project.
ontoB Non-zero vector to project onto.
defaultValue Default value to return if projection is not finite.

Returns

double3 Vector projection of a onto b or the default value.

Description

Compute vector projection of a onto b. If result is not finite, then return the default value instead.

This function performs extra checks to see if the result of projecting a onto b is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call math.project instead which is faster than this function.


Declaration

public static double4 projectsafe(double4 a, double4 ontoB, double4 defaultValue);

Parameters

Parameter Description
a Vector to project.
ontoB Non-zero vector to project onto.
defaultValue Default value to return if projection is not finite.

Returns

double4 Vector projection of a onto b or the default value.

Description

Compute vector projection of a onto b. If result is not finite, then return the default value instead.

This function performs extra checks to see if the result of projecting a onto b is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call math.project instead which is faster than this function.