OS (e.g. Win10): Win11 Pro PsychoPy version (e.g. 1.84.x): 2021.2.3. Standard Standalone? (y/n) If not then what?: y What are you trying to achieve?: I want to create some path (connected line from top to bottom of the screen), on which a spaceship (an image) comes down with some gravity and some variable drift forces to left and right. My participant should keep the spaceship as close as they can to the path. I also need to have the distance from the spaceship to the path, as a measure of the participant’s performance.
I welcome any suggestions to make this path/grid/connected dots/etc. whose coordinates I can have, with which I can compare the spaceship’s coordinates, at any frame.
Would gym environments work in PsychoPy?
Any suggestions on building this path? (at later stages, it needs to also be random for each participant)
If you upgrade to 2022.1.1, there’s a module in PsychoPy called layout which has some classes you’ll likely find useful - layout.Position creates an object which knows its position across various different spatial units. Multiple layout.Position objects can be added and subtracted from one another to do distance calculations irrespective of spatial units. In 2022.1.1 most visual objects (Polygon, Textbox, Image, etc.) also have an attribute ._pos which is the layout.Position object it uses to calculate its own position.
So you can get the distance between an object (let’s say it’s a visual.Image) and a point like so:
Thanks a lot @wakecarter, I made some changes to the target arrangement in your code to put the targets in a manner that the respective lines among them creates kind of a zigzag path, which can serve as the path that I need. I’ll reduce the number of them, to have a simpler path.