use mouse I minimize potential energy here by using gradient descent to rotate the sprite in such a way that minimizes the y coordinate of the center of the sprite (blue dot) The gradient descent here works by rotating the sprite to two different rotations and comparing the difference in its y coordinate (potential energy essentially) if it gets stuck in a weird position, just pretend scratchcat is good at balancing original title: marginally realistic sprite based cat balloon physics with numeric potential energy minimization v3 might be able to put an obstacle in (make sure to put the different sides on the different sprites as done with the window framing, so top of a cube would be bottom, right side would be left, etc) but I haven't tested it yet and I don't know if it will work. I'm sure this technique can be refined to work a lot better, maybe by measuring the derivative with multiple different rotation offsets and then averaging them together (reason this might work is because the y position is quantized) If you want to use this with a different sprite, make sure the sprite is centered in the costume editor