Can't figure out parabola equation- need to set start point, apex, end point

Hi there, have what seemed a simple problem, can’t figure it out at all…ahg!

I’d like a ball, when thrown to move from the player to a predetermined position, at the same height. It needs to arc in a parabola across that distance, however.

So, say the player(“thePlayer”) is at (40, 100). If they throw, the ball should end up at (display.contentWidth-40, thePlayer.y).

During the balls flight, it should move in a parabola, with it’s apex being 40px higher than it’s starting pixel point, and occurring at exactly screen center. ie, (display.contentWidth/2, thePlayer.y+40)

So we have a starting point (a), midpoint (b), and endpoint ©. Therefore, I ought to be able to move the ball linearly along the x, and exponentially on the y, to make a parabola, via an equation involving a,b, and c.

I’ve tried using a graphing calc and all sorts of websites to find the equation, but am just frustrating myself- the answer is out there, I just can’t get it :frowning: :frowning:

Any help would be much appreciated, from those who listened better in math class! :stuck_out_tongue:

Thank you very much! [import]uid: 69255 topic_id: 16393 reply_id: 316393[/import]

I haven’t used it, but this code is suppose to draw a curve between 3 points.

http://developer.anscamobile.com/code/curve-fitting-catmull-spline

[import]uid: 67839 topic_id: 16393 reply_id: 61177[/import]

Thanks elbowroomapps, I’m looking into that. Looks a bit too complex for what I need, but again, thanks, maybe I can figure out how to work it in :slight_smile: [import]uid: 69255 topic_id: 16393 reply_id: 61179[/import]

You’re welcome.

I was thinking you could use that example, but modify it to put the points of the curve into a table instead of drawing them on the screen.

Then you could use this code example, when the ball is thrown to follow that path.

http://developer.anscamobile.com/code/move-object-through-path [import]uid: 67839 topic_id: 16393 reply_id: 61184[/import]