Need help with shooting a projectile

Hi there, I’m new to unity and am making a top down shooter. I have a cube I can move with WASD and it faces the cursor when I move it. I’m having an issue with my projectile, however. I want it to shoot toward the mouse cursor, and it does, however it then follows the cursor, which is not ideal. I’d like the shot to fly toward the initial point where i clicked.
here is my code, I feel like I’m close.


using UnityEngine;
using System.Collections;
namespace Mechanics{
public class Move : MonoBehaviour {

public float thrust;
public Rigidbody2D rb;
	

void start ()
{
	rb = GetComponent<Rigidbody2D> ();

}

void Update(){

		Vector3 shootDirection;
		shootDirection = Input.mousePosition;
		shootDirection.z = 0.0f;
		shootDirection = Camera.main.ScreenToWorldPoint(shootDirection);
		shootDirection = shootDirection-transform.position;

		rb.velocity = new Vector2 (shootDirection.x * thrust, shootDirection.y * thrust);
		            
}

}
}

Unless it should change velocity while moving, you should be able to just move all that update code to Start. If there are no forces acting on the projectile, it should just continue to move along the velocity you’ve set for it.

public float speed; // set in inspector
void FixedUpdate()
{
if (Input.GetButton(“Fire1”) // left mouse button clicked
rb.velocity = transform.forward * speed;
}