ok i want to make a game that involves a catapult but i don't know how to do Tragectory so i looked on wikipedia and it is a total mess. can anyone help me but telling me the equasions i need (i am not very good with trig either)
There is a function you can apply to when you have angle of launch and velocity. This function will show the path of something thrown with gravity being 9.8 m/s2. The equation is this:(1)
In calculator parsing, this is:
θ is angle of launch
v is initial velocity of the object when thrown
x and y are function variables.
For initial height, simply add h, the height to the whole thing.
I got this from here: http://electron9.phys.utk.edu/phys135d/modules/m3/Projectile%20motion.htm
EDIT: Don't forget to have the calculator mode in DEGREE
Degree or radian mode doesn't matter, just make sure that the angle of launch is in the corresponding unit. Finally, don't be afraid to vary the constant 9.8 when it's in a game, play around with it and choose what looks reasonable.
There is another method for handling trajectories of flying objects in a game: it's not as accurate, but simpler to implement, and probably faster. When a projectile is launched, you assign two sets of variables to it: X and Y for the position, and two others (I use U and V for no particular reason) for the X-component and Y-component of velocity.
Then every time you update the position of the projectile, you would replace X and Y by X+U and Y+V. If there were no gravity, that would be all you have to do. To account for gravity, also subtract a small number from V every time you do this (the exact number depends on how powerful you want gravity to be). Here's a simple program that does this:
Xmin→X Ymin→Y 5ΔX→U 10ΔY→V Pt-On(X,Y,2 Repeat getKey Pt-On(X+U,Y+V,2 Pt-Off(X,Y,2 X+U→X Y+V→Y V-ΔY→V End