Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am trying to create a game that involves two or more people jumping on a seesaw and propelling each other in the air. I need help with the physics equations

Assume no friction and no air resistance for now. Ideally when you hit the sweet spot of the seesaw at the very end person B should go a little bit higher than person A who just came down. Also, if you hit close to the pivot, then the reverse should happen (I don't know if that is really physics but that is what I am going for).

I know the classic example of two forces on each side and t = r x F so if you had a mass heavier on one side that heavier mass would have to be closer to the pivot.

enter image description here

What I am not grasping is if F=ma, and assuming that the masses are all equal then F=a. Now gravity is 9.8/m/s/s on both objects. Is this true even if one of them is at rest on the ground so the seesaw is tilted up?

enter image description here

So because force is not related to velocity the following doesn't make sense:

I would have thought dropping an object from 10 meters would have created more F then from 5 meters if they hit the same spot and have the same mass. So while the velocity increases the acceleration is constant isn't the force constant?

What am I not grasping?

share|improve this question
    
Well, it's not that trivial: when an object falls and hits a lever, it has to lower its kinetic energy that it accumulated while falling. Now, assume you just put the object exactly on the end of the lever and let gravity act on it (it should have zero kinetic energy to start with). Then indeed, the force involved in the equation is constant and it is constantly acting on the lever, thus setting in motion the other end object. The lever ratio will tell you the exact amount of acceleration the other object ends up with. In the other case, you need to consider the energy transfer as well :) –  teodron Oct 15 '13 at 15:04
    
Seesaws are not perpetual. Ideally they're balanced and people add force (by pushing with their legs) to change the balance. –  Byte56 Oct 15 '13 at 16:04

4 Answers 4

up vote 2 down vote accepted

It doesn't sound like your use of the word "force" is precise here. If you drop an object from 10 meters instead of 5 meters, the acceleration (and therefore the total force) will have to be higher if it stops in the same amount of time in both cases, so that's true. In the sitting case, the total force is zero, even though the force of gravity is present, nothing a. In the physical sense the mentions of "energy" here are misleading. You don't really have much conservation of energy here, because the collisions with the see-saw are inelastic and do not conserve energy. You don't have much F=ma here, because if you used some force like that you'd still have to deal with angular things. You don't even have conservation of linear momentum: the fact that the see-saw is attached to the essentially infinite mass earth ruins that, and it means that momentum is not conserved during collisions with the seesaw.

So: No energy, force (save for m*g), or linear momentum needed. Instead: Torque and angular momentum.

We need a few variables:

  • I0, the moment of inertia of the see-saw (it plays the same role as mass).
  • g, the acceleration of a free body due to gravity.
  • m[i], the mass of the ith particle sitting on the seesaw.
  • x[i], the position of the ith particle sitting on the seesaw.
  • q, the angle of the seesaw, with q=0 meaning it's flat.
  • qdt, the rate of change of the angle of the seesaw.
  • k, since seesaws have springs in them, "k" can be our spring constant which tries to return the seesaw to its original position.
  • mu, seesaws have friction and don't continue bouncing forever, so mu will be our friction variable which tries to slow the seesaw down.

So, what's the problem we want to solve. There are two things we want to do: Solve for the dynamics of the system when no one is sitting down on or jumping off the seesaw, and the instantaneous collisions, which happen when someone sits down or jumps off. The first one we can figure out using arguments about torque, and for the second we can use angular momentum.

(for a quick refresher: torque is the rate of change of angular momentum, just like how force is the rate of change of momentum. When I say "moment of inertia is like mass", that's because the equation "force=mass*acceleration" takes the form "torque=moment of inertia*angular acceleration". Likewise, "momentum=mass*velocity" is "angular momentum=moment of inertia * angular velocity")

Dynamics

Lets start out with the dynamics of the seesaw (that is, ignoring the people jumping on and off it). The actual moment of inertia of the seesaw with all those extra masses on it is I=I0+m[0]*x[0]*x[0]+m[1]*x[1]*x[1]+.... (this is a simple consequence of the definition of moment of inertia as the sum of m*r^2 terms)

We'll denote the variable for angular acceleration as qddt. There are only a few torques we need to take into account. As stated above, torque=moment*angular acceleration, so we know that the total torque is equal to I*qddt.

  • Torque due to the seesaw's spring: The spring constant should try to restore q to zero, according to the spring constant k. The standard way of doing this is to add a torque of -k*q.

  • Torque due to gravity: The torques from the m[i]*g forces are r x F. I won't go through the details here (because people frown on defining "cross product" for 2D vectors and I don't want to add the disclaimers), but basically this just means we tack a factor of r (=x[i]) and sine or cosine onto the m[i]*g force. We find the resulting torque from mass i is -x[i]*m[i]*g*cos(q).

  • Torque due to friction: This should act against the seesaw's velocity according to mu. Like with the spring there are a few ways we could do it, but the easiest is to let the friction be proportional to angular velocity, so we add a torque of -mu*qdt.

The resulting equation is I*qddt=-k*q-mu*qdt-(x[0]*m[0]+x[1]*m[1]+...)*g*cos(q), and we can divide through by I to get the angular acceleration.

Instantaneous Collisions

To solve for what happens during instantaneous collisions, we use conservation of angular momentum. This states that the angular momentum before a collision is the same as the angular momentum after the collision. Lets say mass i=0 suddenly leaves the seesaw with velocity v, at an angle a away from the center of the seesaw. (where I take a=0 to mean straight away from the center of the seesaw, and a=90 degrees to be straight up off the surface of the seesaw [in the right-handed sense])

  • Before the collision: This is simple. With I the same as in the last section, the angular momentum of the whole system is I*qdt.

  • After the collision: Let I2=I-x[0]*x[0]*m[0] be the moment of inertia without taking m[0] into account. Then the angular momentum of the seesaw alone is I2*qdt2, where qdt2 is the angular velocity of the seesaw without mass 0 on it. Using the definition of angular momentum with the vector cross product r x v, we can argue that the angular momentum of mass 0 about the center of the seesaw is x[0]*m[0]*v*sin(a). So, the total angular momentum is I2*qdt2+x[0]*m[0]*v*sin(a).

Putting them together, we have that I*qdt=I2*qdt2+x[0]*m[0]*v*sin(a). If we solve for qdt we can solve for what happens when a mass hits and sticks to the platform, and if we solve for qdt2 we can figure out what happens when a mass jumps off the platform.

Summary of Equations

  • I=I0+m[0]*x[0]*x[0]+m[1]*x[1]*x[1]+... (definition of I)

  • I2=I0+m[1]*x[1]*x[1]+... (definition of I2)

  • I*qddt=-k*q-(x[0]*m[0]+x[1]*m[1]+...)*g*cos(q)-mu*qdt (dynamics to solve for acceleration)

  • I*qdt = I2*qdt2+x[0]*m[0]*v*sin(a) (conservation of angular momentum where mass 0 jumps off the platform and moves with velocity v away from the platform at angle a, [where a=0 implies you're heading parallel to the seesaw's platform, and a=90 degrees implies you're heading perpendicular to the seesaw's platform]. qdt is the velocity whall m[0] is attached, qdt2 is the velocity after m[0] is detached. Solve for qdt or qdt2 depending on which case you have.)

So, there. I always like to start from a physically-motivated model, and the terms are understandable "torque" and "angular momentum" equations, so they can be modified if you don't like the behavior! Like, if you want a different formula for pushing down when someone jumps off, you could fiddle around with that x[0]*m[0]*v*sin(a) term and multiply it by some fun function, or you could apply a torque for a period of time, etc.

Example

I wrote an uncommented application to show that the equations are valid, but there are a few issues: the velocities of the balls leaving the platform might not be right, due to factors introduced when changing between screen coordinates and x[i] coordinates. https://www.khanacademy.org/cs/see-saw/2232261551

share|improve this answer
    
What about a seesaw without any springs? (torsion springs in your case).. just a plain old, critically balanced lever? In theory, you could avoid the angular momentum/inertia tensor hacks altogether and just use the energy transfer + force equations. Anyhow, nice answer, but a bit too long. If you edit it a bit to make it straightforward to follow, it might be the best option! –  teodron Oct 16 '13 at 7:06
    
@teodron I made it nicer, let me know. No shorter, but I did delete some paragraphs and format it. I don't see how energy/force equations would make things nicer here: as I see it to use more force things you'd need a bunch of collision detection and conditional statements, and to use energy equations you'd need to do the same thing as above, while making up values for energy loss and dealing with qdt squared instead of just qdt. –  NeuroFuzzy Oct 16 '13 at 9:22
    
good efforts, I'll let you know if I spot something fishy. Overall, quite a read :) –  teodron Oct 16 '13 at 9:39
    
Thank you for this, the website and the example, this seems to be what I need. Now I just need time to digested it. –  Mike Oct 16 '13 at 12:48

(I don't know if that is really physics but that is what I am going for)

This is the key statement. You don't want real physics. You want fun, pretend physics. Your focus should be on something that feels good and looks right-ish, irrespective of how physical it actually is.

The real problem here is that you're using static intuition for a dynamic environment. You'll have a much easier time thinking in terms of energy. Imagine that the landeing person transfers all of his Kinetic energy to the standing person. Then you can scale the transferred energy based on how far he is away from the pivot. The closer to the pivot, the more energy the pivot will absorb. Farther out limits the maximum velocity that the faller can impart.

Here is a method of getting something like what you're asking for, or what it sounds like you have in mind. Imagine applying a scalar down the seesaw based on how far it is from the pivot. From the Pivot:

20% - - 40% - - 60% - - 80% - - 100% - 110% - 100% - - 90%

Apply the same to the opposite side. When someone lands, take the product of the scalar tied to where he landed with the scalar for where the other guy is standing. Then transfer that much energy to him.

Start with something like this, then start tweaking it. Game physics is considerably less about getting it right, and considerably more about making it feel right.

I can elaborate on the actual physics if that's still what you want.

share|improve this answer
    
Both answers are good. But I am going to mark this one because I think I am going to go with this implementation. If you hit the spot you go higher, if you miss you go lower, somewhat simple. –  Mike Oct 15 '13 at 20:14
    
Sorry I gave the answer to NeuroFuzzy given the detail and the time, but thank you for your answer. –  Mike Oct 16 '13 at 12:48

Ideally when you hit the sweet spot of the seesaw at the very end person B should go a little bit higher than person A who just came down.

No, if that were the case, energy would not be conserved. At the peak of person A's height, he has mgh potential energy. When he hits the seesaw, all that potential energy is now kinetic energy 1/2mv^2. Ideally, the seesaw will perfectly transfer the kinetic energy to person B. If his mass is the same, then his kinetic energy is the same at launch, which means it'll take the same amount of height to transfer it all to potential energy.

However, seesaws are not ideal and take some amount of energy, so realistically the height will be lower and lower with each launch until all energy is lost.

This is for a game though, which means that you don't have to follow the laws of physics exactly. If you want this kind of positive feedback loop for height, then give the player control to move the character downwards faster than gravity (by holding S or something), or just add/multiply to the initial launch velocities.

share|improve this answer
1  
Not only the energy transfer isn't 100% efficient, but it isn't instantaneous either. The amount of energy is usually transferred in a period of time. To cheat, the OP might consider it as an instant acceleration spike/or impulse that alters the other body's velocity. Extra energy is usually added by the action of the weight on the other end while the lever and the body are still in contact. –  teodron Oct 15 '13 at 15:20
    
@teodron Yeah I was trying to keep the ideal version very simple. The solution is definitely to tweak person B's velocity or cheat physics in some way though. –  Robert Rouhani Oct 15 '13 at 15:24
    
Ok I understand that, I think, and I knew that there would be loss of energy transfer somewhere. Thanks for the formula for kinetic energy. What I am still not grasping is how distance from the pivot factors in? I think of when we were kids we would fling our pencils by putting half of it over the edge and then striking down. If you hit the edge the pencil would fly. If you hit close the desk your hand would hurt. –  Mike Oct 15 '13 at 15:25
    
@Mike the thing about physics in video games is that it has to look right, it doesn't have to be right (and in some cases, what people say looks right isn't actually right at all). I would start with a linear function that went from 0 at the center of the seesaw to 1 at the end and multiply the launching velocity by that value. You can then tweak it to be more or less forgiving, or perhaps to go past 1 if you hit the sweet spot. –  Robert Rouhani Oct 15 '13 at 15:35
    
@Mike, consider my scenario, where the falling object starts in contact with the lever/plank. The weight force from this object is then transferred via the lever (with a ratio) to the other object, altering its velocity. There is a moment in time when the other object will actually set off and fly/stop touching the lever. The falling body wastes some potential energy/work which gets transferred to your other body. If that body comes back, it will transfer this waste to the initial body, hence the energy will be conserved, as in real physics :D –  teodron Oct 15 '13 at 16:00

In adittion to the answers, the reason why the movement changes depending on the distance from the pivot is because the contact with the seesaw also generates torque = r x F, where r is the aforementioned displacement and F is the applied force.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.