diff --git a/Boids.html b/Boids.html index bef7f84..d4ce70b 100644 --- a/Boids.html +++ b/Boids.html @@ -446,7 +446,7 @@

Accelerating Ball

-

This is all stuff we've basically done, but we also need a method to simulate all the physics. +

This is all stuff we've basically done, but we also need a way to simulate all the physics. From physics, we know that acceleration is the rate of change of velocity, and that velocity is the rate of change of position.

@@ -461,12 +461,17 @@

Accelerating Ball

As we'll soon see, we have to do this in a very careful way.

-

Enter deltaTime

+

Enter deltaTime

Until now, we've not really considered how long each frame takes. It'd be reasonable to assume each frame takes about 1/60 seconds to process however each frame takes a slightly different amount of time and, when simulations get more complex, each frame might take a non-slight different amount of time! -

+ +

To test this theory, console.log the deltaTime variable inside the draw() function; it will set itself to the time taken to process the previous frame!

+ +

Using deltaTime

+ +

We know $v = p/t$ (where )

diff --git a/Images/Boids/SpeedAgainstTime.drawio b/Images/Boids/SpeedAgainstTime.drawio new file mode 100644 index 0000000..0b4ccdd --- /dev/null +++ b/Images/Boids/SpeedAgainstTime.drawio @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +