Topic was automatically imported from the old Question2Answer platform.
Asked By
Muricy
Thanks to anyone who can help…
In this situation my yellow amoeba is moving through a matrix of points to point A … arriving at point A, it needs to go to point B …
But this movement needs to be done in an arc … as in the blue line.
I tried CURVE2D, but it returned a straight line …
Can someone help me create this matrix of points between 2 vectors in the form of a curve.
Thanks!
const COMPLETION_TIME = 5.0
var time_passed = 0.0
var A = Vector2(100, 100)
var B = Vector2(300, 300)
var X = Vector2(B.x, A.y)
func _physics_process(delta):
if time_passed < COMPLETION_TIME:
time_passed += delta
var f = time_passed / COMPLETION_TIME
var Y = A.linear_interpolate(X, f)
var Z = X.linear_interpolate(B, f)
position = Y.linear_interpolate(Z, f)