Fix bouncing when staying on the ground.
Now, there is still a min_p that is respected.
This commit is contained in:
parent
a0db41689c
commit
dc213cdeeb
1 changed files with 4 additions and 4 deletions
8
Ball.cpp
8
Ball.cpp
|
@ -31,10 +31,10 @@ void Ball::_compute_pos(double dt) {
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
double n_time = crt_time - stop_bouncing;
|
double n_time = crt_time - stop_bouncing;
|
||||||
Center.y = ((radius * (1.0 - exp(-n_time)) + radius)/2.) + (radius -
|
double min_rad = radius - min_height;
|
||||||
((radius * (1- exp(-n_time)) + radius)/2.)) * sin(5. * n_time);
|
Center.y = min_height + ((min_rad * (1.0 - exp(-n_time)) + min_rad )/2.) +
|
||||||
v_x *= 0.99;
|
(min_rad - ((min_rad* (1- exp(-n_time)) + min_rad)/2.)) * sin(5. *
|
||||||
v_z *= 0.99;
|
n_time);
|
||||||
}
|
}
|
||||||
Center.x += dt * v_x;
|
Center.x += dt * v_x;
|
||||||
Center.z += dt * v_z;
|
Center.z += dt * v_z;
|
||||||
|
|
Loading…
Reference in a new issue