Hello,

This may be a simple maths issue or it could be much. much more complex. Hear me out…

The arm holding the pen (pictured below) can be moved around the ginormous sheet of paper using the keyboard arrow keys (up, down, left and right).

53285-hand1.png

The player can draw black circles using the pen by holding down the X key. Over the white sheet of paper is a drawing guide with already drawn black circles (guide dots) at a 0.5 opacity.

Now, when the arm moves, I want it to move to the exact center of the next guide dot in the direction pressed by the player. The center of each guide dot is evenly spaced from each other, they are just different sizes.

What makes this difficult is that the guide dots are at an angle, and there are literally thousands of them. I’ve tried playing it by eye and guessing what the distance is from each guide dot, but by the time I’ve moved 10 spaces in any direction, the hand is out of sync with the guide dots.

Am I being stupid? How can I calculate it so that the hand moves to the center of the next guide dot exactly.

I would contain the arm “Player” Object into an empty object which center 0,0,0 were on the exact end of the pen. (Sorry if my English isn’t good enough :p) Then every time the player press an arrow set the position of the empty to the center of the circle.

Now… I think that the main problem is that the points aren’t on a vertical or/and horizontal direction. You need to set some rules about what Up,Down,Left and Right mean.

Hope that helps.

You need to know two things about the dot’s position: the distance between the centers of two dots and the angle from the “up” vector and the vector between two dots. Then to find the x offset you need to move you multiply the distance times the Cos of the angle, and to find the y offset it’s the distance times the Sin of the angle. If you multiply those offsets in the appropriate direction with each user key press that should keep the hand in the middle of the dot each time.