Quantcast
Channel: Installation and Deployment
Viewing all articles
Browse latest Browse all 22112

Rotation based on Mouse-Position

$
0
0
Hello Community ;) I am working on a little game (similar to frozen bubble), and I have a problem with the rotation of the Arrow, which shows the direction to shoot. The arrow on the bottom of the image, should alwas point to the current position of the mouse-cursor. I already search in this forum, right now I have this code to rotate the arrow, but the rotation-behavior is quite strange. var a1 = mouseX - arrowBody.x; var b1 = mousey - arrowBody.y; var angle = Math.atan2(a1,b1); // var angle = angle / (Math.PI / 180); arrow.rotation = angle; As you can see in the code, I also tried to work with degrees, but nothing worked for me. I hope you can help me! Thank you, nor0x

Viewing all articles
Browse latest Browse all 22112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>