1234567891011121314151617181920212223242526 |
- /*
- * 2D Physic Engine
- * particules.cpp:
- * Based on pikuma.com Learn Game Physics Engine Programming course.
- * Copyright (c) 2022 986-Studio. All rights reserved.
- *
- * Created by Manoël Trapier on 07/06/2022.
- */
- #include <physics/particle.h>
- void particle::integrate(double dt)
- {
- this->acceleration = this->sum_of_forces * this->invMass;
- this->velocity += this->acceleration * dt;
- this->position += this->velocity * dt;
- this->clearForces();
- }
- void particle::addForce(const vec2 &force)
- {
- this->sum_of_forces += force;
- }
|