Give the object you want to pin three instance variables.
a - angle from other object
d - distance from other object
ra - relative angle from other object
Then to set it up you’d do an event like this: for this example we are pinning the blue object to the red object.
Start of layout
— blue: set a to angle(red.x,red.y,blue.x,blue.y)-red.angle
— blue: set d to distance(red.x,red.y,blue.x,blue.y)
—blue: set ra to blue.angle-red.angle
Then the positioning would be:
Every tick
— blue: set position to red
— blue: move self.d pixels at angle self.a+red.angle
— blue: set angle to self.ra+red.angle
That’s basically it. When there are multiple objects to pin to you’d want to store the uid and stuff.