Page 1 of 1

Swing Explorer

Posted: Tue Nov 13, 2018 4:01 pm
by testtubegames
How does swinging work? Like - pumping your legs... how does that get you swinging higher and higher?


It's simple enough to actually go to a playground and swing - but when you start going into conservation of energy/momentum/angular momentum, this topic can get a bit (a lot) confusing. For instance, this forum thread: ... rk.611639/
or this academic paper:

So I thought I'd make the simplest model I could think of, and get a better understanding of what's going on. Take a look, and try it out yourself:


So... did you figure it out? What's happening here?

Re: Swing Explorer

Posted: Mon Mar 18, 2019 10:47 pm
by tightwad
I'm not exactly sure, but I think it's the tension in the rope! My teacher, brother, and mathematical dad told me a lot about centripetal force (and centrifugal force, which, apparently, doesn't exist). I came to this conclusion because I noticed that the second the tension in the rope was less than the force of gravity, the rope would gain slack, and could no longer take the kid any higher. When I set the rope to be rigid, however, the problem disappeared. The rope sort of "stores" your energy you put into it by pumping your legs, and by pumping you legs when you reach the "peak" of the energy hill, or, the downswing, you add more energy to the highest point of energy. I know this from prior experience playing "Kerbal Space Program" where when you fire your engine at the lowest point in your orbit, it significantly increases your height when you get to the highest point. Thank you for showing how this works with an interactive game rather than an static piece of paper.

Also, I'm not sure If I'm exactly right, but I'm pretty confident. Please correct me If I'm wrong.


Re: Swing Explorer

Posted: Fri Jun 21, 2019 3:07 pm
by Ed_B
Man, I have been puzzling over this exact question for quite some time, so when I saw this I clicked on it immediately. Now it all makes sense. It was the option to turn off the gravity that made it all click for me. It also didn't hurt that I've been thinking about locomotion in zero gravity a lot lately. My theory is as follows:

If you are at rest in outer space with nothing to push on, it is impossible to displace yourself. However, it is possible to rotate yourself, as shown in this video. The astronaut uses his arms and legs as reaction wheels, allowing him to change his orientation without needing a net torque from another object. The same principle is at work here: turn off gravity, and you are still able to rotate your center of mass with respect to the swing's pivot point. This is because the motion of your feet produces a greater torque in one direction than your head produces in the other.

To further simplify: Replace the swinger with a flywheel, connected to the swing bar by a motor. Still imagining that we're in zero gravity, what do you think will happen when the motor activates?
That's right, the whole swing will start rotating, in the opposite direction from the flywheel. Turn the motor back off, and as the flywheel stops spinning, the swing stops too.
Now, a human swinger is like a flywheel that can only rotate through a limited angle. This small rotation in the flywheel induces an even smaller rotation in the swing. But by timing that small rotation at the peak of your swing, you lend yourself precious gravitational potential. Bit by bit, those angular displacements add up.

Unrelated note: Are you the same Andy Hull who created the engine for Spelunky HD? I wouldn't be surprised; it's one of the most airtight physics simulations I've ever come across, and I've seen just the same from your games.

Re: Swing Explorer

Posted: Fri Jun 21, 2019 4:55 pm
by testtubegames
tightwad wrote:
Mon Mar 18, 2019 10:47 pm
I'm not exactly sure, but I think it's the tension in the rope!
Interesting - but doesn't the tension you're noticing in the rope aim towards the point the swing is hanging from? How could that force accelerate the swinger side-to-side... wouldn't it just be able to accelerate them towards or away from that point?
Ed_B wrote:
Fri Jun 21, 2019 3:07 pm
This small rotation in the flywheel induces an even smaller rotation in the swing.
Ah - I like this notion of using angular momentum to try to understand it. (Glad the gravity-free mode was useful!) One of my favorite bits of this puzzle is that you can look at it in several ways, and they're each different. There's the energy perspective, the angular momentum perspective, and the force perspective. So if the angular momentum perspective is making sense to you, my question then becomes (sorry) what's the unbalanced force that's getting the swinger to move?

Oh, and I'm Andy Hall, not Hull, so that's a bit of a funny coincidence, but no, not me on Spelunky.

Re: Swing Explorer

Posted: Mon Jan 20, 2020 6:18 am
by Philosophy
For this explanation, I want you to open up the game, and turn off gravity. When there is no gravity, all movements that require an imbalance in force stop working. In other words, you cannot accelerate, meaning your velocity of zero, stays at zero. However, when gravity is turned back on along with the force diagram, you will see the force of gravity does not become unbalanced, but changes direction, this is key to understanding. Now try to reduce the height of the swinger to zero. You will see that even though before you could produce a force, now you cannot. Increase your height to a positive value. You see, the formula of universal gravitation gives us a little insight. The force of gravity is equal to the mass of object one multiplied by the mass of object two divided by the distance between their center of masses squared multiplied by the gravitational constant. Newton's law of universal gravitation without the gravitational constant does not work. If you paid close attention, without it, the unit it would describe would be Mass^2Distance^-2. To make the law into a force, the gravitational constant has a unit of Mass^-1Time^-2Distance^3. Though this is just a side note. What really makes this matter is the distance. The head and the feet of the swinger are at different distances from the center of mass of the simulation and therefore have different amounts of force on them. When you pump your feet forward and your head back, gravity will more strongly influence your feet and this is shown when the force of gravity changers directions to pull you back down. Gravity will pull you together and by pumping your feet up, you are going against gravity. Gravity will compensate for this and pull you greater by the feet and lesser by the head. When this is done, the net gravitational force is changed. Essentially, you are rotating your body in space and changing the distances between the center of gravity and certain parts of your body to change the strength of gravity on each part of your body. Now reread this at least once to have the perspective to know how certain elements will effect the results.

Experiment with the theory. Hypothesis what might happen and then experiment. When experiment and your understanding contradict, try to think of what went wrong.

Re: Swing Explorer

Posted: Mon Sep 21, 2020 7:26 pm
by TheLevelMakers
I don't know how my screenshot worked but here is a bug:

After 10000 total energy the person gets disconnected.

And what is the shape of the ground after the cliff?

Re: Swing Explorer

Posted: Wed Sep 23, 2020 10:43 am
by testtubegames
Oh, really? They pop right off the swing? Cool! I guess I haven't gotten them running so fast before.

And to answer your question, after the cliff the ground is still flat, just lowered down below the screen so you can't see it.

Re: Swing Explorer

Posted: Thu Sep 24, 2020 3:50 pm
by TheLevelMakers
It can not be flat because the potential energy is different depending on how far you throw the person.

Re: Swing Explorer

Posted: Thu Sep 24, 2020 4:01 pm
by TheLevelMakers
here is an 100 potential energy cliff