Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


project

Compute vector projection of a onto b.
Read time 3 minutesLast updated 4 days ago

Definition

project(float2, float2)

Compute vector projection of a onto b.
public static float2 project(float2 a, float2 ontoB)

Parameters

Vector to project.

ontoB

Non-zero vector to project onto.

Returns

Type

Description

float2Vector projection of a onto b.

Remarks

Some finite vectors a and b could generate a non-finite result. This is most likely when a's components are very large (close to Single.MaxValue) or when b's components are very small (close to FLT_MIN_NORMAL). In these cases, you can call _projectsafe which will use a given default value if the result is not finite.

project(float3, float3)

Compute vector projection of a onto b.
public static float3 project(float3 a, float3 ontoB)

Parameters

Vector to project.

ontoB

Non-zero vector to project onto.

Returns

Type

Description

float3Vector projection of a onto b.

Remarks

Some finite vectors a and b could generate a non-finite result. This is most likely when a's components are very large (close to Single.MaxValue) or when b's components are very small (close to FLT_MIN_NORMAL). In these cases, you can call _projectsafe which will use a given default value if the result is not finite.

project(float4, float4)

Compute vector projection of a onto b.
public static float4 project(float4 a, float4 ontoB)

Parameters

Vector to project.

ontoB

Non-zero vector to project onto.

Returns

Type

Description

float4Vector projection of a onto b.

Remarks

Some finite vectors a and b could generate a non-finite result. This is most likely when a's components are very large (close to Single.MaxValue) or when b's components are very small (close to FLT_MIN_NORMAL). In these cases, you can call _projectsafe which will use a given default value if the result is not finite.

project(double2, double2)

Compute vector projection of a onto b.
public static double2 project(double2 a, double2 ontoB)

Parameters

Vector to project.

ontoB

Non-zero vector to project onto.

Returns

Type

Description

double2Vector projection of a onto b.

Remarks

Some finite vectors a and b could generate a non-finite result. This is most likely when a's components are very large (close to Double.MaxValue) or when b's components are very small (close to DBL_MIN_NORMAL). In these cases, you can call _projectsafe which will use a given default value if the result is not finite.

project(double3, double3)

Compute vector projection of a onto b.
public static double3 project(double3 a, double3 ontoB)

Parameters

Vector to project.

ontoB

Non-zero vector to project onto.

Returns

Type

Description

double3Vector projection of a onto b.

Remarks

Some finite vectors a and b could generate a non-finite result. This is most likely when a's components are very large (close to Double.MaxValue) or when b's components are very small (close to DBL_MIN_NORMAL). In these cases, you can call _projectsafe which will use a given default value if the result is not finite.

project(double4, double4)

Compute vector projection of a onto b.
public static double4 project(double4 a, double4 ontoB)

Parameters

Vector to project.

ontoB

Non-zero vector to project onto.

Returns

Type

Description

double4Vector projection of a onto b.

Remarks

Some finite vectors a and b could generate a non-finite result. This is most likely when a's components are very large (close to Double.MaxValue) or when b's components are very small (close to DBL_MIN_NORMAL). In these cases, you can call _projectsafe which will use a given default value if the result is not finite.