# Parabolic Motion

**URL:** <https://forum.kirupa.com/t/parabolic-motion/332470>\
**Category:** flash\
**Created:** [June 20, 2014, 6:53am UTC](https://forum.kirupa.com/t/parabolic-motion/332470 "2014-06-20T06:53:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanDaMan](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@DanDaMan](https://forum.kirupa.com/u/DanDaMan)\
**Post date:** [June 20, 2014, 6:53am UTC](https://forum.kirupa.com/t/parabolic-motion/332470/1 "2014-06-20T06:53:15Z")

</div>

I’ve looked around for a while trying to find a good way to go about doing parabolic motion but I’m still having trouble. The idea is that I have a starting point, and ending point, and then either an initial angle or max height of the curve (doesn’t really matter) and I need the projectile to travel through this curve. I looked at several tutorials but I cannot find one that supports using points other than roots, for example, the points (10, 20) and (50, 30). Since the y values are different I don’t know how to go about using the formulas I found.

Here’s what I have so far:

```auto

private var speedX:Number;
private var speedY:Number;
.
.
.
var g:Number = 1; // gravity
var sx:Number = en.x - x; // where x is the starting location and en.x is the ending location
var sy:Number = y - en.y; // same for y
var o:Number = 45; // launch angle
var v:Number = (Math.sqrt(g) * Math.sqrt(sx) * Math.sqrt((Math.tan(o) * Math.tan(o)) + 1)) / Math.sqrt(2 * Math.tan(o) - (2 * g * sy) / sx); // velocity
			
speedX = Math.cos(o) * v;
speedY = Math.sin(o) * v;

```

and then in my update function

```auto

x += speedX;
y -= speedY;
speedY -= 0.25;

```

It seems to work decently with most values, but when the ending location’s y value is lower than that of the starting location, it kinda just shoots straight down.

How could I go about doing this? Thanks!
