# 2D rocket lander vectors (gamedev)

I'm writing a game prototype with simple 2D Physics, of a 2D rocket "lander" style.

Let's assume that there is a downward gravity of (0, -1).

The rocket has an up-vector (that can be also described as an angle) and it generates a thrust of e = -2g from its "down" vector; From a simple formula:

v = (u * e) + g


I'm able to predict the resulting 2d velocity when the Rocket is pointing upward to u vector. For example, if the rocket is pointing up (90 degree, normalized vector (0, 1)):

v = ((0, 1) * 2) + (0, -1)
v = 0,1 (rocket lifts with 1g force and no movement in x, as expected)


Now, for a 30 degree inclination:

v = ((0.87, 0.5) * 2) + (0, -1) v = (1.74, 0)


At this angle, the rocket finds a balance between gravity and its thrust moving only sideways. This is also verifiable by assuming that to keep movement y = 0 the resulting y component of thrust vector should cancel gravity (for e = 2g, it should be 0.5) So the angle should have a Sine of 0.5, then

arcsin(0.5) = 30 degrees


The question is, I want to be able to find the correct up vector to give the rocket an arbitrary v resulting velocity (to reach any target in 2d space). If we rearrange the formula:

u = (v - g) / e


The Problem is, to this work I should input vector v in correct length and I don't have it. I have just a direction to the target, normalized.

In the above example, 30 degrees should be the result if I was asking for 0 degrees (right vector) resulting velocity. But I would input v as (1, 0) and not (1.74, 0).

I'm sure I'm missing something very very basic but right now my mind can't unwrap it.

• I think what you are asking is really a math question. Can you provide with a sketch of the thrust vectors and other important things. Dec 11 '20 at 19:44

Your calculations are correct, but the problem is that if the angle of the vector $$u$$ is the only thing you can change then you cannot have control on both the angle and the magnitude of the output $$v$$: they will not be independent. So as long as the thrust $$e$$ is fixed you cannot have $$v=(1,0)$$, whichever the angle is.