How do I make my object dash the way it is facing?

Hello everyone, I hope you’re all having an excellent day,

I’m in a need to add a dash, well, more of a burst of speed, to my spaceship, that could propel it forwards at a higher speed than it is already going at, in it’s forwards direction, regardless of the speed or the angular velocity it has, without it giving me any errors on this script.

public class ShuttleMovement : MonoBehaviour

{
float speedForce = 10f;
float torqueForce = 3f;
public ShuttleMovement()
{
}

// Start is called before the first frame update
void Start()
{
    
}
void Update() { }

// Update is called once per frame
void FixedUpdate()
{
    Rigidbody2D rb = GetComponent<Rigidbody2D>();
    if (Input.GetButton("Accelerate"))
    {
        rb.AddForce( transform.up * speedForce);
    }
    rb.AddTorque(Input.GetAxis("Horizontal") * torqueForce);
}

}

I can’t seem to get it right.

Cheers.

Do you want the Spaceship to go to an higher speed while the Accelerate button is pressed?

Because you could use rb.velocity for this case… Like that:

// Start is called before the first frame update
 void Start()
 {
     
 }
 void Update() { }
 // Update is called once per frame
 void FixedUpdate()
 {
     Rigidbody2D rb = GetComponent<Rigidbody2D>();
     if (Input.GetButton("Accelerate"))
     {
         rb.velocity = transform.up * speedForce ;
     }
 }

I didn’t know what rb.AddTorque was for so I didn’t write it…