THANKS!!

arc     I’ve read the entire internet and I’m still haven’t figured this out. Can someone here help?

I want Santa to throw a snowball. So I create a snowball object and on each frame I update it’s position by adding the vector to the position to get the new position.
But vectors are always linear. I’m trying to think of some way to use the algebraic function for a parabola to get the ball to travel an arc path – but nothing I try works.

I *could* just do it with a bunch of if statements, like this:  (if snowball > starting positition + 10){ reverse y direction; }

But that gives me less of an arc and more of a sharp angle, plus – it’s not very elegant.

If angry birds and Bloons can do it, surely it’s not too hard, right?

UPDATE:

Thanks everyone for your help! I think I understand it a *little* better now. I had more control when I turned off the engine gravity and made gy myself. Here are two solutions that worked really well for me in case anyone has this same issue:

 

arc2  In the second one, playing with the first three variables gives you different sizes and speeds of arc on your ball.

Comments

exdef
01. Dec 2014 · 20:10 UTC
Hm, I think you should just decrease the velocity of the snowball each frame and have gravity pushing the ball down each frame.
01. Dec 2014 · 20:13 UTC
Ever tried thinking about what forces are excerted on an object, that makes it go in an arc?

I give you a tip: it’s gravity.

And gravity accelerates an object, meaning it’s changing the velocity of an object.
01. Dec 2014 · 20:16 UTC
My games have terrible, constant speed, no velocity graphics. Do something really simple.
trianglPixl
01. Dec 2014 · 20:16 UTC
If you want to assume no air resistance, a parabola should be pretty simple. The horizontal speed is always constant since no forces are acting on it. Calculate it however you want and you should be set.

Vertical velocity is handled by a quadratic function. If you have an initial vertical speed, you can just choose to accelerate the ball downward (y -= gravity strength * time elapsed^2).

If you want to “throw at speed in the direction of “, you have an initial position and an x distance and y distance, which helps you get your x speed and initial y speed.
dwild
01. Dec 2014 · 20:17 UTC
You will either have to use the good old equation of parabola, y = x^2 and work with that, or use gravity like exdef suggested. I don’t suggest the parabola because it become ugly fast and gravity is so simple.
TheColorMan
01. Dec 2014 · 21:18 UTC
Make the Y axis velocity decrease at a constant rate (like 0.1) every frame. Just like gravity, it will constantly accelerate things downwards. It doesn’t sound like it works at first, but it’s doing what gravity does.
quill18
01. Dec 2014 · 22:52 UTC
The solution is very straightforward.