Feedback based on mouse position

Hello all,
I am designing an experiment with the builder to present 80 images on different locations on a 360-degree wheel. Then I want participants to choose the correct location of the image with a mouse click on that wheel. I know I can take the mouse position as an output. However, I need to give immediate feedback about the angle difference between the correct location and participants’ responses.
As far as I can see, the solution seems to be adding polygons and give feedback based on whether the mouse click is on the correct polygon or not. However, I am trying to obtain a continuous measure, and it seems exhaustive to add 360 polygons…
I am adding a short clip of the current experiment: - Google Drive
I will appreciate any suggestions. Thank you :slight_smile:

No, the solution is trigonometry :hugs:. The centre of the screen (and I guess the centre of your circle) are the origin at (0, 0). So it is easy to use the x, y coordinates of the mouse to work out an angle relative to the origin. From SOHCAHTOA, you know that the tangent of the angle is O/A, or y/x in this case. So take the inverse tangent of that to return the angle:

response_angle = np.arctan(mouse.pos[1]/mouse.pos[0])

The angle will be in radians so you might want to use rad2deg(response_angle) to convert to degrees. Also bear in mind that PsychoPy stimuli I think use a convention where 0 is at 12 o’clock and angles run clockwise, whereas the numpy (imported as np) module functions I think use the standard mathematical convention of anti-clockwise angles starting from 3 o’clock.

Your instincts here are correct - whenever the solution seems to involve lots of duplication, it is almost certainly an indication that a snippet or more of code is required instead.


Thanks a lot for your kind response. :blush: It was extremely helpful! If anyone is interested in further discussion about my experiment, I would be happy to!

1 Like