How to make a Camera follow an object and then distance itself from the object when a button is held down?

I’m trying to get a Camera to move opposite of the direction a RocketShip moves when I transform the position of the RocketShip up (along green axis) for every frame the “w” button is pressed down. When the “w” button is not pressed, I need the camera to follow the same direction as the RocketShip, but still stay the same distance away from the RocketShip.

When “w” is pressed I have the RocketShip thrusting up:

public class PlayerController : MonoBehaviour {
void FixedUpdate () {
		ThrustRocketShip ();
	}

void ThrustRocketShip () {
		if (Input.GetKey ("w")) {
			rb.AddForce (transform.up * thrust);
			if (thrust < 10f) {
				thrust += 0.8f;
			}
		} else {
			thrust = 0;
		}
	}
}

I can’t figure out how to get the camera’s transform to move in the opposite direction. The closest I’ve gotten is by trying to modify the transform of the camera when “w” is pressed. I just don’t know how to modify the camera’s position by the inverse of the RocketShip’s up:

public class CameraFollow : MonoBehaviour {

    public Transform rocketShip;
public Vector3 offset = -10;

void FixedUpdate () {
    if (Input.GetKey ("w")) {
        //1st attempt, I know this doesn't work
        /*
        Vector3 temp = rocketShip.up;
        temp.y += 2f;
        transform.position = temp;
        */

        //2nd attempt, I also know this won't work
        /*
        transform.position = rocketShip.up * -1f;
        */
    }
}

This is, by far, the most challenging mechanic I’ve ever tried to implement. And this point I’m losing hope, yet unwilling to give up. If you need anymore context or clarification please let me know.

I’VE FIGURED IT OUT! So simple too, a little agitated about it.

I needed to create an offset that constantly added the inverse of the rocketShip.up vector3. Then I needed to set a fixed update to update the camera’s transform position to continue to follow the rocketShip. I also needed to change FixedUpdate to LateUpdate since there was also an issue causing the camera to move further away than intended. See below for how I did this:

public class CameraFollow : MonoBehaviour {
	
	public Transform rocketShip;
	public Vector3 offset;

	void LateUpdate () {
		if (Input.GetKey ("w")) {
			offset -= rocketShip.up * .01f;
		}
		transform.position = rocketShip.position + offset;
	}
}

Now I can get to the good stuff. I’m going to lerp the camera and rocketship, giving the rocketship a thrusting effect. And make a maximum “x” and “y” value for the offset so that the spaceship never goes off the screen of the camera. Thank you all for following my question and taking the time to ponder my question with me. I hope this can be of help to someone in the future.