Simple Spring

Please enjoy this simple spring simulation I made.

Since I posted this, I have also quickly added the option to change the spring distance, spring constant, spring dampening, and whether or not there is gravity.

nice! you probably already know this, but when the spring goes too far, it switches direction. i'd prefer it if it didn't

the gravity is also very cool

i am enjoying this immensely

Getting it to not flip is kinda difficult, the spring having self-collision would be nice but I'm not sure how to go about that.

perhaps if the spring ball intersects with the origin point, then reflect the ball's XY velocity towards the direction of the red dot?

That wouldn't be very accurate or interesting behavior imo

Nice, I love it, thanks!

The problem is that you have 0 ways to simulate angular momemtum,and also because the spring is only not a rigid body in one direction.
Reduce it to a bunch of springs and constrain the direction change of each atom.

??? that would be incredibly resource intensive

yeah

Back when Mitch Resnick was working on massively parallel computation, one of the starlogo demos did this. I believe I've also seen it as a Smalltalk demo, but I'm not sure. What's very cool about this approach is that you don't program the large-scale behavior at all, just each tiny bit of spring reacting to the tugs from its immediate neighbors, and the "springiness" of the whole system emerges.

As a proof of concept you could do it with 10 or 20 clones of a spring chunk sprite.

It's interesting how this simple motion attracts one's attention, more than, say, one of those Rube Goldberg-style marble runs.

I would like to do that if I weren't on a Chromebook, all of that happening at once would be pretty slow I'd imagine.