Miojo wrote:mcompany wrote:So, one of my friends was trying to make a game, but he ran across something that was a small problem on how to do something, long story short, I managed to figure out most of the components of projectile motion in two dimensions, but I don't know how to solve for either the x velocity or the y velocity, and I was wondering if someone could help. The components to solving it is:

Code: Select all

`x/a=t and t= c+d and c=-b/g and h =b*c+(1/2)*g*c^2 and d=sqrt(-2(y-h)(g))/g and a^2+b^2=v^2`

solve for either a or b, given x, y, g, and v

It would be easier if you told us the problem instead of throwing the equations. What you want and what you have in terms of physics/math? Ex: You want the position (x,y) in a specific time (t) given an initial velocity vector (V) with its components (Vx and Vy) and an acceleration (Ax and Ay)?

I want the initial velocity components (or the initial velocity's angle, whichever is easier), given the initial velocity vector (v), given an acceleration in the y direction (gravity, or g) with no acceleration in the x direction, and given the the object passes through the point at (x,y).

If you really want me to explain literally every part of the process to get to those equations, I can. Also, since I was trying to use some equation solvers later when I tried to solve it myself, I did reduce some variable into things that don't make sense, particularly "a" (the initial velocity x component), "b" (the initial velocity y component), "c" (a part of time solved in the y components), and "d" (another part of time solved in the y components). Do note that I actually did make 1 mistake in my calculations ( d=sqrt(-2(h-y)(g))/g ), but rest assured, it all is mostly solved for when it comes to the physics itself

(And no, gravity is not -9.8, and I myself don't know what he programmed gravity to be, but gravity is 100% constant and defined in his code)