Main content
Course: Pixar in a Box > Unit 4
Lesson 2: Code your own simulation- Starting with particles
- Step 1 (particle under gravity)
- 1D spring-mass system
- Step 2 (spring-mass system)
- Damping
- Step 3 (damped spring-mass system)
- 2D spring-mass system
- Step 4 (2D spring-mass system)
- Multiple spring-mass system
- Step 5 (multiple spring-mass system)
© 2024 Khan AcademyTerms of usePrivacy PolicyCookie Notice
Multiple spring-mass system
Mass spring systems are essential for simulations in animation. By adding a second spring and mass, you can create more complex models like hair, trees, and clothing. Different spring values mimic various materials, making mass spring systems versatile for designing realistic animations. Explore and create your own simulations for endless possibilities!
Want to join the conversation?
- In the video (from 48 second) it is stated that to calculate force for spring1 we need take into account additionally spring2 force and spring2 damping force but I don't see such components in later video equation.
Did I miss something?(9 votes) - At1:06, we learn that the spring and damping forces for the lower spring must be applied to mass 1, which makes sense. But the code, at1:45, does not include the second spring in the calculation of the net force of mass 1.
Am I misunderstanding or is that an error in the video?
Also, if you were to include the force from the lower spring upon mass 1 as well as mass 2, aren't you somehow double-counting that? Don't you have to apportion the total spring force to the individual masses in order to conserve energy?(7 votes)- For the first part, I think, yes, these things are not added in the code. We also do not get a realistic feeling when the simulation runs in the video.
For the second part, no we are not double counting the forces. The spring applies equal force on both of its sides. You can think of it trying to do whatever it can to get back to its natural length, so it applies equal forces on both of them.
The effect of these forces, however depends on other factors like individual masses and stiffness of the spring.(1 vote)
- are you guys like students from around the world or what?(5 votes)
- i watched this vidio twice, and all i heard was springs, x, y, even more springs. it does not make scence to me.(3 votes)
- its kinda difficult for the coding.(1 vote)
- At1:33, why does she say "ow" instead of "now"?(1 vote)
- What kind of other spring mass?(0 votes)
- when will the project not crash(0 votes)
- i can wait to make a cartoon(0 votes)
Video transcript
(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.