Pavlovia Unknown Position Unites: Undefined Error

I need psychopy to pick a point within a circle that is within a square. So, I set the bounds of the square around the circle, like so:

circle.setPos([0, 0.3]);
tlower_bound_x = -0.1
tupper_bound_x = 0.1
tlower_bound_y = 0.2
tupper_bound_y = 0.4

And then I want it to pick a random point within those bounds:

target_x = Math.random() * (tupper_bound_x - tlower_bound_x) + tlower_bound_x;
target_y = Math.random() * (tupper_bound_y - tlower_bound_y) + tlower_bound_y;


However, if a point is chosen outside of the circle, I want it to keep picking a point until it finds a points within the circle:

while not circle.contains([target_x,target_y]):

This works locally, but when I put it on pavlovia, it gives me this error:

  • when getting the position of an object
  • when converting a position to pixel units
  • unknown position units: undefined

Any help would be appreciated, thank you.

Hi, Please can you share your pavlovia project ?


I apologize, I am very new to this. How do I do that?

Let me know if that works for you.

What units is target using?