glass22 Posted December 17, 2013 Share Posted December 17, 2013 Hi, I'm trying to make an object slowly face a mouse cursor, the object is current in degrees. I'm just not sure what math to do? Quote Link to comment Share on other sites More sharing options...
rich Posted December 17, 2013 Share Posted December 17, 2013 var dx = mouse.x - sprite.x;var dy = mouse.y - sprite.y; return Math.atan2(dy, dx);This will give you the angle required to point the sprite at the mouse in radians. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.