This question already has an answer here:
I want to rotate the cannon based on mouse position.
So far I tried various solutions I found over the web but non of them are working, I know that I only need to rotate the cannon on the Z axis because this is a 2D game, so I don't touch X and Y axis.
Does anybody know how can I rotate the cannon based on mouse position?
Or at least provide me a sample script on where to start.