aboutsummaryrefslogtreecommitdiffstats
path: root/src/particlebody.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/particlebody.cpp')
-rw-r--r--src/particlebody.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/particlebody.cpp b/src/particlebody.cpp
index f882f279..7435737c 100644
--- a/src/particlebody.cpp
+++ b/src/particlebody.cpp
@@ -1,5 +1,6 @@
#include "Physics/particlebody.hpp"
+#include <iostream>
#include <cmath>
namespace yage
@@ -26,16 +27,15 @@ void ParticleBody::update()
Vector2d last_acceleration=acceleration_;
// update the position of the body
- //position_.x+=velocity_.x*time_step+(0.5*last_acceleration.x*std::pow(time_step, 2));
- //position_.y+=velocity_.y*time_step+(0.5*last_acceleration.y*std::pow(time_step, 2));
-
position_+=velocity_*time_step+(0.5*last_acceleration*std::pow(time_step, 2));
// update the acceleration
if(gravity_)
acceleration_=Vector2d(force_.x()/mass_, (GRAVITY+force_.y())/mass_);
else
- acceleration_=Vector2d(force_.x()/mass_, force_.y()/mass_);
+ acceleration_=Vector2d(force_.x()/mass_, force_.y()/mass_);
+
+ std::cout<<acceleration_<<"\n";
Vector2d avg_acceleration=(acceleration_+last_acceleration)/2.0;