What I’m trying to make is a cannon that you can aim with your mouse. Then press the fire button to fire the cannonball. Just as a human cannonball. This all in 2D.
Please take a look at the sketch that I have attached.
I have googled a lot but I still don’t know where to begin.
Does anybody know a tutorial that can help me?
By the way, the art work is no problem.
I’m still trying to make a cannon like the picture above.
The first step is to find out how to grab an object with the mouse and move or rotate it.
Does anybody know where to start or where I can find a tutorial where something like this is done?
you can attach a mouselook.cs script onto it and set it to MouseY so then it will move only up and down, then tweak the sensitivity and limits of the angles. then attach a shoot.js script that can be found easily on the unityAnswers page. and make spnerical cannonball and add some gravity onto it, and that will be your bullet
Convert those into an angle relative to the breech of your gun tube.
Smooth the angle via a lerp, then rotate the tube to the new angle.
A more sophisticated method uses joints and motors. I use that for my artillery - the results can be very realistic. A demo vid of work in progresss follows…