Main content

### Course: Pixar in a Box > Unit 7

Lesson 2: The physics of particle systems- Start here!
- Graphing motion over time
- Position, velocity and acceleration
- Vector addition
- Velocity and acceleration vectors
- Understanding net forces
- Net forces
- Force and acceleration
- Applying gravity to a particle
- Particle collisions
- Particle collisions
- Animating particles
- Particle calculations

© 2024 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Animating particles

Now we'll pull everything together and explore how we calculate the position of a particle over time, frame by frame. To animate particles, we calculate positions and velocities over time, using equations of motion to compute acceleration. Then, we apply these concepts to create a ping pong ball simulator!

## Want to join the conversation?

- This is just too much info to take in one lesson. SLOW DOWN!(26 votes)
- I feel ya buddy :((2 votes)

- This makes no sense, can someone dumb it down for me?(19 votes)
- OMG YEEESSSSS I am in seventh grade i am crying it so hard jesus help(1 vote)

- I'm interested in learning more about particle systems but I haven't studied physics in detail. Under what subcategory would this come under here on khan academy?(7 votes)
- There's a lesson on the coding, which also covers the physics here:

https://www.khanacademy.org/computing/computer-programming/programming-natural-simulations/programming-particle-systems/a/intro-to-particle-systems

If you just want the physics, then 2D motion:

https://www.khanacademy.org/science/physics/two-dimensional-motion

And Newton's laws would be useful:

https://www.khanacademy.org/science/physics/forces-newtons-laws(9 votes)

- I don't understand all this. I am just watching the videos because I want to.(7 votes)
- LOL it's really hard for me to understand, too!

Pls give us a "physics for complete dunderheads" book!!

Or at least make it a little dumber so we can understand!(5 votes)

- I'm interested in learning particles more because i am still struggling with the formations.(5 votes)
- Wait, so at the end he says that we will make our particle simulations, but where? Because I don't see any place to go and do that on Khan Academy?(4 votes)
- He did not say that you would, but that you can. You can learn how to program using HTML and JavaScript. I believe there is an exercise involving crating your own particle system.

https://www.khanacademy.org/computing/computer-programming/programming-natural-simulations/programming-particle-systems/a/intro-to-particle-systems

This is probably a pretty advanced subject, so if you don't know how to program in JavaScript, then you'll have to start with a much earlier lesson.

EDIT: You'll probably want to start here: https://www.khanacademy.org/computing/computer-programming(2 votes)

- can anyone understand anything?(4 votes)
- i get it but i am in 4rth grade(1 vote)

- I have NO CLUE what any of this means!(4 votes)
- I could not understand the formula , if I could get some help it would be nice(4 votes)
- At1:07, how did the teacher arrive upon 'p2=(t2-t1)V1+p1?' Could you show me how he got it? Also, what is the Velocity formula?(2 votes)
- To answer your first question, he took the formula for the slope between p1 and p2:

V1 = (p2 - p1)/(t2 - t1): Slope is rise over run, or the change in y over the change in x

He then multiplied both sides by (t2 - t1):

V1(t2 - t1) = p2 - p1: multiplicative property of equality

Then he added p1 to both sides:

V1(t2 - t1) + p1 = p2: additive property of equality

then, if you want, you can flip the equation by the reflexive property to get p2 = V1(t2 - t1) + p1.

At0:23, he says he is using the slope of the position over time as his velocity: so the change in position divided by the change in time.(3 votes)

## Video transcript

- The final step to complete
our particle simulator is to develop a method to track particle motions forward in time. That's how our computer
program will animate them. One frame at a time. We said earlier that if you know the equation of motion of each particle, then you can compute the
velocities and positions from it. But how exactly? To answer that question, let's go back to the idea of velocity as the slope of the
position versus time curve. Put two values of time, t one and t two, close together, and let p one be the
position at time t one and let p two be the
position at time t two. The slope of the line l, shown here, is a good approximation of the velocity v one at time t one. The closer that t two gets to t one, the better the approximation. As an equation, the slope of l, that is the velocity v one, is given by the change in position divided by the change in time. If we know the position
and velocity at time t one, then we can compute the
position in time t two by rearranging this
equation to solve for p two. Great. So knowing the
particle's position and velocity at time t one, we can compute
the position at time t two using this formula. But how do we get the
velocity at time t two? Well, if we know the equation of motion, then we can compute the
acceleration at time t two. For instance, if the particle is just being acted on by gravity, then the acceleration is constant, and is given by the
gravitation constant g. We also know that the acceleration is the slope of the
velocity versus time curve, meaning gravity equals
a change in velocity divided by the change in time. And we can solve this for v two. Now that we know p two and v two, we can repeat this process to compute p three and v three and so on, for as long as we like. Let's do an example. Suppose that at the
start of the simulation, we set our time parameter t to 0, our particle is at point p
one with velocity at v one, and the gravity vector g points down. To figure out where the particle will be at time t equals one half, we use the equation p
two is equal to v one times the quantity t two
minus t one plus p one, where t one is equal to zero
and t two is equal to one half. So, p two is equal to one
half v one plus p one. Meaning that p two is halfway
between v one's tail and head. And to figure out v two, we use v two is equal to g times the quantity t two
minus t one plus v one. G here is the gravitational
vector which points downward, and on Earth, has a magnitude of 9.8 meters per second squared. Again, t two minus t one is one half, so v two is equal to
one half g plus v one. Great. Now we can compute the position and velocity at t equals one using the same formulas. Although this is rather
tedious to do by hand, it is relatively easy to
write a computer program to do these calculations for us. Like this. Congratulations. We now have all the parts we need to create a ping pong ball simulator. (chimes) In the final exercise, you can test your understanding of these concepts before moving on to create your own amazing
particle simulations.