Dave Doga Oz
Dave Doga Oz

Reputation: 1268

How to move the button which stays on tangent around the circle based on touches?

I have a circle that has a button on its tangent. I want to move that button around of circle, it will still stay on its tangent just the angle will change. I can move it by changing angle, but how to move it based on touches onto screen?

Upvotes: 1

Views: 78

Answers (1)

MBo
MBo

Reputation: 80187

You can find touch point angle relative to circle center and use it:

Angle = Math.atan2(touchpoint.y - circle.center.y, touchpoint.x - circle.center.x)

Upvotes: 1

Related Questions