I'm making a 2D space-shooter game, and I want the enemies to have specific movement patterns, ranging from simplistic like a linear left-right loop, to more complex like a parabola left-right motion (starting left upward, moving down approaching the center, then going upward and right in the end)
I've tried using two AnimationCurve variables, one for each axis, but the movement always comes out wonky and weird no matter the function, using the following code:
transform.position = new Vector3(posX + movementX.Evaluate((Time.time) * movementMultiplier), posY + movementY.Evaluate((Time.time) * movementMultiplier));
Is there a way of achieving this using AnimationCurve variables (preferably one) and evaluating them? If there's not, can you suggest another method?
Thanks in advance.
↧