[C#]Angle of shooting equale to mouse direction

Hi all! Im making a game similar to geometry wars - YouTube ,
so now i’m trying to making shooting like that, the angle of shooting is equale to the mouse direction, so how can i do this? I tried this, but it doesnt seem to work. Thanks for any help!

public class Bullet : MonoBehaviour
{

public float speed = 50f;

// Use this for initialization
void Start ()
{

}

// Update is called once per frame
void Update ()
{

	transform.position = Vector3.MoveTowards(transform.position,Input.mousePosition,Time.deltaTime * speed);

}

}

You want to use Camera.ScreenPointToRay() to find a point in space where the the mouse hits, so you will use a Ray and a RaycastHit object for this. The doc for RaycastHit gives a good example you should be able to use for your script.

using UnityEngine;
using System.Collections;

public class Bullet : MonoBehaviour {
    public float speed = 50f;
    void Update() {
        
            RaycastHit hit;
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit))
            {
               transform.position = Vector3.MoveTowards(transform.position, hit.point, Time.deltaTim * speed);
            }
    
    }
}

This moves something constantly in the direction of the mouse’s position every frame and will move the object (bullet) in the direction of the mouse after it was fired. Without watching the video, if that isn’t the destired effect you can get the hit.point value in Start() and then move towards hit.point every Update() function. (assuming this is Instantiated and Start() gets called when you “click” or press a button somewhere).