Getting a smooth sine wave movement

I’m trying to make the enemy go down in a sine wave movement (a smooth zig-zag), the things highlighted in the red box are the problematic part, the enemy currently goes downwards to the right diagonally and never goes to the left like I imagined it should. I’ve tried messing with the numbers, but it still went downwards to the right. I appreciate all the help.

1 Like

Hey,

your sine is constants, so your Y is always 0.099 x 1000 = 99. That’s way your actor move only in right. Try to connect GetGameTimeSinceCreation or GetGameTimeInSeconds to your sine. I think you get a better result when you use cos instead of sin. You can also move your actor through AddActorLocalOffset.

5 Likes

I appreciate the time and effort you put in to this, thank you so much, it works the way I wanted it to now :slight_smile: