I’ve done this so far >
but the problem is that it only works on the half of the left side of the screen and doesn’t even rotate to the full parameter that I’ve set (-90min 90max) >
I’ve done this so far >
It’s a bit unclear what are you trying to achieve.
Do you want the cannon to always point towards the mouse ?
Or do you want mouse movements to rotate the cannon, regardless of where the mouse is ?
Agreed, it’s unclear how you want it to rotate. The above does not work because the mouse position outputs values in the range 0-1920 if that’s the resolution / viewport size you’re using. This is around 90px only:

This is closer but not enough, most likely:
You’d still need to deal with relative rotation if the whole tank can rotate, too. But to advise, we’d need to know more about how it all works.
Do tell.
Thanks for replying! I hope this clears up what I’m trying to achieve a bit more
I want the canon to rotate 180 0r 90 degrees only in that range
And yes the vehicle does rotate as well
This worked beautifully >
THANKS A TON @Everynone !! Your code was all the code I needed actually, all I added was relative rotation of the arrow >
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.