Tag Info

Hot answers tagged


You need to create a vector pointing towards the mouse -> Subtract the position of your cannon from the position of your mouse. vector2 dir = mouse.position-cannon.position Then you get the angle from this vector by using this formula if y is up and x is right angle = arctan(dir.y/dir.x) // or use atan2(y,x) Now you have the total angle that you need ...

Only top voted, non community-wiki answers of a minimum length are eligible