Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

Vertex.Lerp

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 void Lerp(ref Vertex a, ref Vertex b, float t, out Vertex result);

Parameters

Parameter Description
a The vertex written to result when t is 0.
b The vertex written to result when t is 1.
t The interpolation factor. 0 selects a, 1 selects b.
result Receives the interpolated vertex.

Description

Interpolates between two vertices, writing into result a new vertex a fraction t of the way from a to b.

Use this when a mesh modifier adds vertices between existing ones — for example when subdividing, tessellating, or clipping geometry. The continuous vertex data (position, tint, texture coordinate, and the internal anti-aliasing data) is blended; the discrete per-vertex data that identifies the draw (clipping, element, texture, and gradient identifiers, and flags) is taken from a.

Because that discrete data is copied rather than blended, a and b must belong to the same fill (the same draw within one VisualElement) — which is always the case when resampling the triangles of a single mesh. t is not clamped: values outside the 0..1 range extrapolate beyond the endpoints.


Declaration

public static Vertex Lerp(ref Vertex a, ref Vertex b, float t);

Parameters

Parameter Description
a The vertex returned when t is 0.
b The vertex returned when t is 1.
t The interpolation factor. 0 returns a, 1 returns b.

Returns

Vertex The interpolated vertex.

Description

Interpolates between two vertices, returning a new vertex a fraction t of the way from a to b. Convenience overload that returns the result instead of writing to an out parameter — handy when the value is temporary.