Avoid entering the block if we already stopped bouncing

This commit is contained in:
Rémi Oudin 2018-02-13 12:47:33 +01:00
parent afc7b4a3b9
commit f4b1299d3e

View file

@ -70,7 +70,7 @@ void Ball::_compute_v_z(Point normal) {
void Ball::update_pos(double dt) {
crt_time += dt;
if (crt_time >= T) {
if ((bouncing) && (crt_time >= T)) {
double old_t = T;
double max_t;
Point normal = surface.getNormalVector();
@ -83,7 +83,7 @@ void Ball::update_pos(double dt) {
_compute_v_z(normal);
max_t = (T - old_t)/2.0 + old_t;
if ((bouncing) && ((A + B * max_t - (G_CTE / 2) * max_t * max_t + min_height) < radius)) {
if (((A + B * max_t - (G_CTE / 2) * max_t * max_t + min_height) < radius)) {
stop_bouncing = crt_time;
bouncing = false;
}