Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a space ship moving in XYZ space in a random direction. That ship is facing a different random direction. Given both the ships velocity and direction I am trying to calculate braking power for each of the ships thrusters, 1 in each direction of the ship (forward, backward, left, right, up, down or x+, x-, y+, y-, z+, z-). Further complicating the problem, the ship may be using thrusters on any of it's axis.

I am trying to find three velocities that I can apply along the ships axis to stop it's motion along any of those axis.

As an example the ship is moving with a velocity of (1,0,0) and facing (0,0,1), I need an equation that will bring the X velocity to 0 so the ship does not continue to slide along the X axis. This is just a simple example however as the equation needs to be able to work on any vector.

Does anyone know how I could solve this problem?

I am trying to write this for a computer simulation, and my current solution of just dividing the current velocity and then adding thrust doesn't work very well.

Once again, I know the: Ships Velocity, Ships Direction and Current Thrust.

share|cite|improve this question
It seems that where you write "random" you mean "arbitrary"? – joriki Nov 19 '12 at 16:30
It is easy to represent the velocity as $\vec v=(v_x,v_y,v_z)$. How do your represent the heading? Just taking the vector along the ship axis leaves the angle of rotation around that vector unspecified. – Ross Millikan Nov 19 '12 at 16:39
up vote 0 down vote accepted

I'd solve this as follows:

Let's call our ship's orientation vector $\mathbf{\theta}$, its current velocity $\mathbf{v}$ and say that we have thrusters that fire in directions $\mathbf{t_1}, \mathbf{t_2}, ... \mathbf{t_n}$ (all specified relative to the ship).

First we want to transform our velocity and thruster directions into the same co-ordinate system, which we can do just by finding the rotation matrix $R$ corresponding to $\mathbf{\theta}$ (see for how to do this), then just rotating $\mathbf{v}$ into ship-space: $$\mathbf{v'} = R \mathbf{v}$$

Now we want to find how much to fire each of the thrusters so that we come to a stop. That's the same as solving the following equation: $$\mathbf{v'} + \sum_i \alpha_i \mathbf{t_i} = 0$$ where each $\alpha_i$ tells is how much we need to fire thruster $\mathbf{t_i}$. This is actually just a system of 3 simultaneous equations that we can solve using Gaussian elimination or whatever we like and use the solutions for the $\alpha_i$ to tell us how much to fire each thruster.

share|cite|improve this answer
Thanks, that works. Appreciate the help, I spent over two weeks trying to put something together that worked. – Runewake2 Nov 19 '12 at 17:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.