Shooting Towards Cursor Location


I’ve been thinking of a small side project to work on when bored that uses the main mechanic of shooting towards the mouse location. All I need is a general explanation of setting the velocity to the correct number to correct go towards the location for shooting bullets.

I know how to get the location in an x and y on a Vector2 plane, how do I make the objects go towards that position. (Not go to it then stop, but just shoot in that direction).


  • A

Lots of these threads:

If you really want to fully understand it, heres some basic trygonometry :slight_smile:

EDIT: Theres also a way to do it using only Pithagoras and some divisions/multiplications/additions/substractions.

Don’t poison his mind with angles just yet! :stuck_out_tongue:

It will be useful for him in the future :slight_smile: You can also do some nice smooth animations with them.