Why reset the acceleration with each tick

Hey, I realise that this is a detail about the simulation rather than how to code in Swift, but I was confused about one aspect. This has to do with the code on page 47, near the bottom. In the simulation class, you have the tick function for the entire simulation, where you tick over into the next time increment for each particle. That function looks like this:

func tick(dt: NSTimeInterval) { for particle in particles { particle.acceleration = particle.acceleration + gravity particle.tick(dt) particle.acceleration = Vector() } time += dt }

My question is: why set the acceleration back to zero (the third line in the for loop)? I get you first want to find the acceleration after the effect of gravity, then use that acceleration to figure out the new position and velocity of the particle. But if you set particle.acceleration = Vector() won’t that put the acceleration back to zero, meaning every iteration of the loop after the first one will have acceleration equal to gravity only? Am I missing something?

Thanks in advance!

Hold on, think I just got it Are we assuming that the particle is initially “launched” but then has no further acceleration? So basically, no “thrust” or anything like that, it just goes from the initial boundary condition and is thereafter only affected by gravity, i.e. like a cannon ball launched from a cannon?

Yes!