3D Space thruster force problem.

Simple spaceflight force, it needs tweaking… But my problem is that it always adds the force applied relative to world, and not local rotation. How can I fix that?

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(Rigidbody))]
public class PhysicsFlyer : MonoBehaviour
{
    public float maxThrust = 15f;
    public float maxStrafe = 10f;
    public float engineForce = 2f;
    public float maxVelocityChange = 2f;
    public float accelerationSmooth = 20;

    private Vector3 velocityChange;

    void FixedUpdate()
    {
        velocityChange = new Vector3(Input.GetAxis("Horizontal") * engineForce, Input.GetAxis("Vertical") * engineForce, 0);
        if (velocityChange.magnitude > 1)
            velocityChange = velocityChange.normalized;
        velocityChange += new Vector3(0, 0, Input.GetAxis("Mouse ScrollWheel") * engineForce * 10);
        velocityChange.x = Mathf.Clamp(velocityChange.x, -maxStrafe, maxStrafe);
        velocityChange.y = Mathf.Clamp(velocityChange.y, -maxStrafe, maxStrafe);
        velocityChange.z = Mathf.Clamp(velocityChange.z, -maxThrust, maxThrust);

        rigidbody.AddForce(velocityChange, ForceMode.VelocityChange);
    }
}

You can always use

Vector3 globalVelocity = transform.TransformDirection(velocityChange);

which uses your transform’s inbuilt ability to translate between local and global coordinates!