# Ball flight trajectory

**URL:** <https://forum.kirupa.com/t/ball-flight-trajectory/215877>\
**Category:** Uncategorized\
**Created:** [February 11, 2007, 5:09pm UTC](https://forum.kirupa.com/t/ball-flight-trajectory/215877 "2007-02-11T17:09:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikehins](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@mikehins](https://forum.kirupa.com/u/mikehins)\
**Post date:** [February 11, 2007, 5:09pm UTC](https://forum.kirupa.com/t/ball-flight-trajectory/215877/1 "2007-02-11T17:09:59Z")

</div>

Hi all

I want to create a golf ball flight animation. I have all the datas and formulas I need but I’m struggling on how to animate it.

// Data of an 8 Iron shot  
var startX:Number = 0;  
var startY:Number = 300;  
var maxHeightX:Number = 88;  
var maxHeightY:Number = 26;  
var landingX:Number = 143.02;  
var landingY:Number = 300  
var endX:Number = 145;  
var endY:Number = 300;  
var velocityX:Number = 17;  
var velocityY:Number = -18;  
var time:Number = 0;  
var timeOfFlight:Number = 5.67; //in seconds  
var gravity:Number = -9.8+velocityX^2;

//I would also like to add the drag effect (friction)  
var friction:Number = 0.3;  
//I also have some more datas that could be helpfull  
var launchAngle:Number = 33  
var horizontalLandingAngle:Number = -7;  
var verticalLandingAngle:Number = 82;

// now here is the formula to calculate the actual x and y during the animation…  
// the Z is the is the initial direction let put that value to 1 form now.  
var theX:Number = velocity \* cos(z) \* time;  
var theY:Number = velocity \* sin(z) \* time + (gravity/2) \* t^2;

I didn’t find any GOOD exemples of what I try to achieve so far.

I need help to make the transition beetween the ascending and descending part of the anim. I’m sure that, from here it sould be quite simple, but not for me 🙂

Thanks for your time
