Godot:Vector2
lastmod 2023-05-09created 2022-03-226 edits
Vector used for 2D math.
2-element structure that can be used to represent positions in 2D space or any other pair of numeric values.
| INFORMATION |
| |
linear_interpolate
Returns the result of the linear interpolation between this vector and to by amount weight.
weight is between 0.0 and 1.0, representing the amount of interpolation.
For reference, the core function code (cpp) can be found in the core/math/vector2.h file.
Vector2 linear_interpolate(const Vector2 &p_a, const Vector2 &p_b, real_t p_t)
{
Vector2 res = p_a;
res.x += (p_t * (p_b.x - p_a.x));
res.y += (p_t * (p_b.y - p_a.y));
return res;
}