Browse Source

Particle Physics: Changing velocity...

Godzil 1 year ago
parent
commit
7aab44bd0a
1 changed files with 4 additions and 3 deletions
  1. 4 3
      source/app.cpp

+ 4 - 3
source/app.cpp

@@ -68,10 +68,11 @@ void application::update()
     }
     this->millisecsPreviousFrame = SDL_GetTicks();
 
+    this->part->acceleration = vec2(0.0, 9.8 * PIXELS_PER_METER);
 
-    this->part->velocity = vec2(100 *  deltaTime, 30 * deltaTime);
-
-    this->part->position += (this->part->velocity);
+    // Integrate the change
+    this->part->velocity += (this->part->acceleration * deltaTime);
+    this->part->position += (this->part->velocity * deltaTime);
 }
 
 void application::render()