(lamp clatters) - Great work making it this far. Now it's your turn to drive. So far we've built a
two-dimensional mass spring system. It's pretty cool, it's the key building block for many simulations. Recall in lesson one we
used multiple springs connected together like
this to model hair. In this video I'm going to show you how to add a second spring
and mass to your system. First let's draw a new force diagram to see what's going on. Let's call our two
masses mass 1 and mass 2, and our two springs spring 1 and spring 2. First let's think about the new forces acting on mass 1, as before, we have the gravity force acting downward, a spring 1 force pulling
up towards the anchor, and a damping force acting
in the opposite direction. However, now there is a new force due to the new spring connecting mass 2. In this case the displacement we use to calculate spring to
force is the difference between both masses, mass 2
position minus mass 1 position, and there is also a damping force resisting the spring 2 force. So we need to add these two
new forces to the x and y components of the mass
1 net force calculation. Now consider the new mass we've added. It will experience the force of gravity as well as a spring 2 force minus the opposing spring 2 damping force. That's it for modifying
our force calculation. At the top we'll need
new initial variables to represent both the position
and velocity of mass 2. I'll set the initial position of mass 2 so that it's below mass 1. The initial velocity of
mass 2 is zero as well. To add a new mass 2 we have to double up all of our equations used for mass 1. However, there are two key differences. For the mass 2 spring force calculations we'll use mass2Position
minus mass1Position as our displacement. And for the mass 2 net force calculations, we have mass2SpringForce
minus mass2DampingForce. Finally, we just need
to draw the new circle and line for this mass and spring. The new line will extend
from mass 1 to mass 2. The new circle will be the
center of mass 2's position, and that gives us this. Mass spring systems are really powerful. At Pixar we don't just use them for hair. The trees in The Good Dinosaur were also simulated with
a mass spring system. Kind of similar to hair, but it had to represent a tree structure. Trees have branches, so we simulated them by having multiple line
segments attached to each other kind of like having
hairs attached to hairs instead of only being
attached to the scalp. Even clothing is simulated
using masses and springs. In Brave, Merida had several
garments that we needed to simulate, and each garment
had their own spring values. These values were chosen
to mimic different kinds of cloth, such as
wool, cotton, and satin. As you can see, mass spring
systems are super useful for modifying and simulating
all kinds of different things. See if you can think of other materials that could be created
using mass spring systems. And that's the goal of this final project. Your job is to modify this program to make whatever you can dream up. The program you spin off
will automatically show up below under the Spin-offs tab, along with everyone else's. And I really encourage you
to check out other creations to get new ideas for inspiration. Have fun, and happy exploring.