Avoid entering the block if we already stopped bouncing
This commit is contained in:
parent
afc7b4a3b9
commit
f4b1299d3e
1 changed files with 2 additions and 2 deletions
4
Ball.cpp
4
Ball.cpp
|
@ -70,7 +70,7 @@ void Ball::_compute_v_z(Point normal) {
|
||||||
|
|
||||||
void Ball::update_pos(double dt) {
|
void Ball::update_pos(double dt) {
|
||||||
crt_time += dt;
|
crt_time += dt;
|
||||||
if (crt_time >= T) {
|
if ((bouncing) && (crt_time >= T)) {
|
||||||
double old_t = T;
|
double old_t = T;
|
||||||
double max_t;
|
double max_t;
|
||||||
Point normal = surface.getNormalVector();
|
Point normal = surface.getNormalVector();
|
||||||
|
@ -83,7 +83,7 @@ void Ball::update_pos(double dt) {
|
||||||
_compute_v_z(normal);
|
_compute_v_z(normal);
|
||||||
max_t = (T - old_t)/2.0 + old_t;
|
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;
|
stop_bouncing = crt_time;
|
||||||
bouncing = false;
|
bouncing = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue