## Physics math question

mcompany
Autonomous Entity Posts: 872

### Physics math question

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^2solve for either a or b, given x, y, g, and v`

Kanishka
Skynet Posts: 1421
Contact:

### Re: Physics math question

Code: Select all

`(x/a)=(-b/g)+sqrt((-2(y-(((b*(-b/g))-b)/2)(g))/g` Fixes break an AI more than bugs do. mcompany
Autonomous Entity Posts: 872

### Re: Physics math question

You still haven't solved it yet (and I fear you messed up on that equation that you got)

Miojo
Script Posts: 37

### Re: Physics math question

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^2solve 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)?

Miojo
Script Posts: 37

### Re: Physics math question

A simple solution is:
X = X0 + Vx*T +0.5*(Ax*(t^2))
Y = Y0 + Vy*T +0.5*(Ay*(t^2))
Where X0 = initial X position , Vx=initial velocity in X axis, Ax = accel in X axis.
Y is similar.
To get Vx and Ax (and Vy and Ay) just decompose the velocity and accel vector in its components. Idk if this is what you need tho...

For example if it is just the "gravity" accel then Ay = -9.8 and Ax = 0

Kanishka
Skynet Posts: 1421
Contact:

### Re: Physics math question

mcompany wrote:You still haven't solved it yet (and I fear you messed up on that equation that you got)

Of course I did. -_-
Fixes break an AI more than bugs do. mcompany
Autonomous Entity Posts: 872

### Re: Physics math question

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^2solve 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)

TheKidPunisher
Autonomous Entity Posts: 565

### Re: Physics math question

The projectile havent a defined initial velocity or acceleration?

mcompany
Autonomous Entity Posts: 872

### Re: Physics math question

TheKidPunisher wrote:The projectile havent a defined initial velocity or acceleration?

Like I said, it is technically assumed that those are defined, but I am trying to solve using any initial velocity or acceleration. Although, like I said, the acceleration for x is 0

Miojo
Script Posts: 37

### Re: Physics math question

Use the formulas that I said. Just decompose your velocity into Vx and Vy and solve for each.

mcompany
Autonomous Entity Posts: 872

### Re: Physics math question

Miojo wrote:Use the formulas that I said. Just decompose your velocity into Vx and Vy and solve for each.

What is "T" and "t" in your formulas?

TheKidPunisher
Autonomous Entity Posts: 565

### Re: Physics math question

So you only have to derivate the equation miojo give,

Vx= Ax t + Vx0
Vy= Ay t + Vy0

With your initial value and according your name of variable
Vx=a
Vy= g t +b

Question, what is «h»? It looks like it is y

mcompany
Autonomous Entity Posts: 872

### Re: Physics math question

h was the highest point in the y direction that the object would go (when the velocity in the y direction is 0, and the object starts falling)

mcompany
Autonomous Entity Posts: 872

### Re: Physics math question

TheKidPunisher wrote:So you only have to derivate the equation miojo give,

Vx= Ax t + Vx0
Vy= Ay t + Vy0

With your initial value and according your name of variable
Vx=a
Vy= g t +b

Also, saying "Vx=a" is like saying "the sky is a sky", and the following is true for "Vy=b". I just said that those were their literal definitions

TheKidPunisher
Autonomous Entity Posts: 565

### Re: Physics math question

So sry i dont know what you search.

Also your projectile have a strange trajectory isnt it?

mcompany
Autonomous Entity Posts: 872

### Re: Physics math question

I don't think it is strange, just a normal parabola

TheKidPunisher
Autonomous Entity Posts: 565

### Re: Physics math question

So why the equation miojo gave you are not good for you?

normally a simple parabola is solved when you get all the initial value...

mcompany
Autonomous Entity Posts: 872

### Re: Physics math question

TheKidPunisher wrote:So why the equation miojo gave you are not good for you?

normally a simple parabola is solved when you get all the initial value...

Sure but then
Vx=(x)/T
Vy=(y-0.5*(g*(t^2))/T

What is "T" and what is "t"?

TheKidPunisher
Autonomous Entity Posts: 565

### Re: Physics math question

i think it is the same time (dont know why he put a maj on one the the time)

Also, the variable is X not Vx, you cant define a initial value by a variable that depend of the initial value. that does not make sense

mcompany
Autonomous Entity Posts: 872

### Re: Physics math question

TheKidPunisher wrote:i think it is the same time (dont know why he put a maj on one the the time)

Also, the variable is X not Vx, you cant define a initial value by a variable that depend of the initial value. that does not make sense

I guess, it makes sense for time in the first one (but time can't be solved for), but in the bottom you ate right that I doesn't make sense that one is capitalized and one is not
I rearraged the equation. I specifically am looking for Vs or By, and it is valid to be rearranged as such