Stability control after barrel roll

I have a spaceship which the player can barrel roll using the A and D keys.

A key => -4 TorqueY
D key => +4 TorqueY

This works reasonably well… the spin takes a while to slow down (which I don’t mind because it makes a cool looking attack for the player) although I would prefer if it didn’t stop so often with the spaceship being stuck upside down.

So I decided to make a “stabilise” button, using the S key (between A and S). When this is pressed, the ship is to restore its roll to an upright direction. So far I have worked out I can achieve this with…

S key => Constraint/Orientation of Z axis (up) to direction of Z as 1, and “damp” of 10.

Seems to work pretty well, except that when I use the S button the ship straightens but then continues to spin after I let go of S key. Obviously the TorqueY is still working.

What do I use to neutralise TorqueY?

Bump — I thought this would be an easy question; was it written too dyslexic?

Hi, you can remove the torque by setting the angular velocity,
there may be a better way but I don’t know.

Attachments

stabilityControlTest_01.blend (131 KB)

Thank you PhilB. It was really good that you gave a .blend file so I could see what you did. Surely there’s a way of assigning the AngularVelocity without a python script but through logic blocks?

Here’s the one I have been playing with (still need to improve bullets from suggestion from another post)

Attachments

tiefighter_game02.blend (46.4 KB)

Yes you can, using the motion actuator.

Yay! 100th post, so I’ll give you a starMap dome! Haha
You can delete it if you don’t want it. Its in the bottom layer and its vertex parented to the ship.

Good Luck with the game.

Attachments

tiefighter_game03.blend (233 KB)