Realistic/No gravity spaceship movement?

Hey, I’m trying to make a spaceship that would have realistic almost Ion-Drive movement, where force is applied to the back upon the press of the W button, but also I need to keep it floating so it defies the normal aspects of a rigidbody. Here’s what I have so far. How would I make it with realistic force applied, turnforce, and so it can defy gravity?

    var speed = 10;
var turnspeed = 5;
function Update () {
rigidbody.AddRelativeForce (Vector3.up * 1);
rigidbody.AddRelativeForce (Vector3.forward * 10);;
rigidbody.AddRelativeForce (Vector3.back * 10);;
transform.eulerAngles.y += -turnspeed * Time.deltaTime;
transform.eulerAngles.y += turnspeed * Time.deltaTime;


Instead of updating transform.eulerAngles you could use AddRelativeTorque, I imagine this would make it more physically realistic.

You will probably get smother movement if you use Unity's Vertical and Horizontal axes for input instead of detecting when the user presses the W, S, A and D keys. Settings for axes can be accessed though the unity editor drop-down menus via Edit/Project Settings/Input.

In order to achieve zero gravity globally, set Physics.gravity to (0,0,0). Settings for this can be accessed though the drop-down menus via Edit/Project Settings/Physics.

What I've done in the script below is set useGravity on your object's rigidbody to false. This means that other rigidbodies in your scene could be affected by gravity but the rigidbody of the object you attach this script to ignores it.

Here's a very basic script I put together, which you can use as a starting point.

var speed = 0.8;
var turnSpeed = 0.15;

function Start () {
    rigidbody.useGravity = false;

function FixedUpdate() {
    if (Input.GetButton("Jump")) { //Spacebar by default will make it move forward
        rigidbody.AddRelativeForce (Vector3.forward*speed);
    rigidbody.AddRelativeTorque ((Input.GetAxis("Vertical"))*turnSpeed,0,0);
    // W key or the up arrow to turn upwards, S or the down arrow to turn downwards.
    rigidbody.AddRelativeTorque (0,(Input.GetAxis("Horizontal"))*turnSpeed,0);
    // A or left arrow to turn left, D or right arrow to turn right.