You probably don’t want to use sin and cos for a “curvy path” movement. Sin and cos would be useful if you want a repeating wave pattern, but if I’m understanding the kind of movement you want, you want to be able to specify a softly curving path for your enemies to move along. Correct?

In come **Bezier curves** to the rescue! A Bezier curve allows you to specify a beginning and ending point, as well as a third point in the middle that influences the curvature of the line. I’ll link you to the Wikipedia article, which makes Bezier curves look a lot more complicated than they are. Ignore all the math formulas here, and just check out the pretty animated gifs, because Bezier curves are like the easiest thing ever to implement.

So you’re familiar with Lerp, right? You feed Vector3.Lerp 2 points and a number from 0 to 1; it returns a Vector3 between the two, based on the number you feed it. On the Wikipedia page, this is shown under the “Linear curve” section.

Alright, so now let’s add a third point in the middle, so now we have A, B, and C. How do we implement this? It’s really, really easy:

```
Vector3 AtoB = Vector3.Lerp(A, B, t);
Vector3 BtoC = Vector3.Lerp(B, C, t);
Vector3 final = Vector3.Lerp(AtoB, BtoC, t);
```

And that’s it. Wrap that code up in a function that takes A, B, C, and t; voila, you’ve made a Bezier curve. You can add another level on top of that to take four points (most of the Bezier curve editors you use, e.g. the pen tool in Photoshop or Illustrator, use four points); you collapse the four points down to three in the exact same way that the first two lines there collapse the three down to two. You can also make it take an arbitrary number of input points and recursively work it down step by step to a single final point, but that’s not necessary right now.

So now, you take this Bezier function. You can now implement movement using this function in place of Lerp, and use this to make the movement smooth and curvy. Each enemy has a list of points, which get fed in two at a time (they become B and C, the current position becomes A).