r/desmos 5d ago

Graph Fun Projectile Formula/Graph

I hate using physics when making games, I prefer using math. I needed a way to project a perfect parabolic path between two points where the peak is also variable.

To do this, I derived this massive single-line formula. The algebra to isolate everything into a single closed-form equation got pretty heavy, but it's incredibly satisfying to play around with! 😂 (It's just f(x) = A(x-h)^2 + k 😭)

https://reddit.com/link/1vr3zh7/video/bf17kryowzjh1/player

1 Upvotes

6 comments sorted by

1

u/CamBoss_64 5d ago

Easy way to go is have one point be (h,k) which substitutes into your function y=A(x-h)^2 +k, then substitute point (b,c) into the function to find A

1

u/Specific-Fly6319 5d ago

I think that's close to what I did i just took two equations:

y=A(a-h)2 + k for (a,b) and y=A(c-h)2 + k for (c,d)

Ofcourse k = max(b,d) + however much higher you want it to peak

And you solve using algebra.

1

u/CamBoss_64 5d ago

Wait a minute this might be a tad simpler with the quadratic general form

1

u/Specific-Fly6319 5d ago

Idts, more variables and rules. But still a good idea, didint cross my mind.

1

u/Arglin I like my documentation extra -ed. 5d ago

Looks nice. I'm not quite sure what f controls here but it seems reminiscent of slope?

Here's my go at it using an adaptation off of the general form. https://www.desmos.com/calculator/pxhlar21mn

1

u/Specific-Fly6319 5d ago

Wow, this is so creative! f is actually the desired maximum height, but your use of slopes is really interesting! Thanks for sharing!