Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

So I have a spaceship and I have 6 degrees of freedom.

At a given moment the following vectors are known of the spaceship:

  • Local forward.
  • Local up.
  • Local sideways (may be implied from the previous two).
  • Angular momentum.

The spaceship has 3 torquers to add/subtract to the angular momentum the in main directions relative to it.

Each of them can add 0 to 1 units of angular momentum per second (so it's possible to run them less than full power when needed).

So from the given vectors, how can I compute which torquers to run to lock on the target vector as quickly as possible?

I think this is a basic problem in the field of attitude control. But I couldn't find good pointers yet (maybe I didn't use the right keywords in my search).

The tricky part is that I want to consider the instantaneous angular momentum. Otherwise I would just cross multiply the forward vector and the desired direction vector to have the desired axis of rotation, but that's not what I'm looking for...

My current idea is the following: use the roll torquers to eliminate the roll component the spaceship rotation if any, while using the pitch/yaw torquers to rotate it into the direction based on pitch/yaw angular differences of the forward and the desired direction and the pitch/yaw component of the spin. But I'm not sure it's the quickest, might not even be correct.

share|improve this question
I am not sure what your problem is, but when I did sth similar I used quaternions in angular momentum and torque equations, it was much easier to think about instead of 3 vectors (matrix). –  concept3d Nov 15 '13 at 13:48
@concept3d The problem is simply that I look for the optimal torquer control, if there any. I've always used matrixes but never used quaternions. –  Calmarius Nov 15 '13 at 14:32
you'll want to bleed off momentum first (counter the existing rotation) and then when it is manageable you'll want to steer towards your goal –  ratchet freak Nov 15 '13 at 14:46
This sounds like a kind of optimal control problem; maybe reading some of the literature about that will help you or give you some ideas. –  Nathan Reed Nov 15 '13 at 17:43

Your Answer


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

Browse other questions tagged or ask your own question.