Bounding Box for Mouse Starting Position


I know that there is a general bounding box option through the CustomMouse parameters for limiting mouse movement, but I was wondering if it was possible to have a mouse starting position start out anywhere within a bound box. Any thoughts?

Thank you!

You can use a Code Component to set the position of a Mouse component, if we call your mouse component MyMouse and the coords you want to set it to x and y, then the code would be:


If you put that in the Start Routine tab then it will set the Mouse’s starting position

I understand how to set the mouse at a specific position, but what I want is for the mouse to start randomly within a bounding box.

I figured this out by doing this:

mlower_bound_x = -0.8
mupper_bound_x = 0.8
mlower_bound_y = -0.8
mupper_bound_y = -0.33
x = np.random.uniform(mlower_bound_x, mupper_bound_x)
y = np.random.uniform(mlower_bound_y, mupper_bound_y)