Fix bouncing when staying on the ground.

Now, there is still a min_p that is respected.
This commit is contained in:
Rémi Oudin 2018-02-13 16:21:38 +01:00 committed by Théophile Bastian
parent a0db41689c
commit dc213cdeeb
1 changed files with 4 additions and 4 deletions

View File

@ -31,10 +31,10 @@ void Ball::_compute_pos(double dt) {
);
} else {
double n_time = crt_time - stop_bouncing;
Center.y = ((radius * (1.0 - exp(-n_time)) + radius)/2.) + (radius -
((radius * (1- exp(-n_time)) + radius)/2.)) * sin(5. * n_time);
v_x *= 0.99;
v_z *= 0.99;
double min_rad = radius - min_height;
Center.y = min_height + ((min_rad * (1.0 - exp(-n_time)) + min_rad )/2.) +
(min_rad - ((min_rad* (1- exp(-n_time)) + min_rad)/2.)) * sin(5. *
n_time);
}
Center.x += dt * v_x;
Center.z += dt * v_z;