2D Sending Object From One Place To Mouse Position.


I’m trying to make a 2D shooter where on click a bullet is fired from the player position to the current position of the Mouse (Using Raycasting). I’ve Instigated the prefab and can make it move using vector2, I just need to know how to store the mouse position where the bullet is going. Do I use another ray variable or raycast variable or something else? Also how do I move the bullet to that position do I still use a vector2 variable?


Getting the Input.mousePosition and substracting the player/gun position from it gives you the direction vector. Apply force on the bullet (or change velocity or whatever you are using).