# Cosine Parabolic

Hello, I will first begin by saying This is not a perfect example, it uses some pretty crude methods to achieve its purpose. I built this last night and today, so that’s some excuse(?). Honestly someone like JR, thebrickcentric, maybe Drafty, maybe Galactian, will probably release a better example for this, but for now, you can have my weak version using a cosine wave (sine wave would probably have been better because a sine starts at the lowest point (could be middle I forgot) compared to a cosine which starts at the peak, forcing me to make some manual adjustment).

So I made a cosine wave before and I didn’t want to go through the process of learning how to make an actual parabolic prediction method so I wanted to use this.

A cosine wave is a wave that moves up and down in a constant pattern, I remembered that with a cosine wave I was able to adjust many variables like the amplitude, repeat length, time, and speed.

I ripped out the equation to just be amplitude and repeat length because those were the most important variables. With that, I made a predefined arc (it didn’t work great an adjustable one) which was now my “parabolic” curve.

Dots are then evenly set along the curve and boom, you now have a target trail. I then added a projectile and tried to make it properly line up with velocity but decided it was impossible with how I was doing it (the amplitude never changes, but the projectile would need to travel at a steeper angle. Maybe adjusting velocity could fix it). So instead I just search for the nearest dot (Has its own problems when dots are close together), rotate towards it, then move forward via velocity.

And that’s basically it. You now have a “predictable” path for a projectile

7 Likes

really sorry to point out bugs right away when im looking at this really cool example, but maybe make the projectiles despawn after a few have been thrown.

2 Likes

3 Likes

Current issue is that it seems to not work with a maximum? Is it that intentional?

1 Like

A maximum of what? Also, it’s not a great example, but the idea of creating a trail to follow may have some merit

1 Like

1 Like

I believe I messed something up in the equation because I did alter it quite a bit, if you wanted here is a proper example of a cosine wave (titled “Perlin noise map” but it isn’t)

1 Like

Cosine isn’t a bad way to make a parabola, if you only use the top half of the wave form (or the first half with pi). Though not sure how that would be handled if choosing 2 seperate points for start and end. I really should look into it soon.

2 Likes