Utility function
This commit is contained in:
parent
14f3b8afdf
commit
f6f789cc2e
1 changed files with 11 additions and 6 deletions
17
Ball.cpp
17
Ball.cpp
|
@ -72,12 +72,7 @@ void Ball::_compute_v_z(Point normal) {
|
|||
v_z *= (0.5 + factor);
|
||||
}
|
||||
|
||||
void Ball::update_pos(double dt) {
|
||||
//double height = (*ground)(Center.x, Center.z);
|
||||
crt_time += dt;
|
||||
if ((bouncing) && (crt_time >= T)) {
|
||||
double old_t = T;
|
||||
double max_t;
|
||||
void Ball::_compute_parameters() {
|
||||
Point normal = (*ground).get_normal(Center.x, Center.z);
|
||||
bounce_number += 1;
|
||||
_compute_U_n();
|
||||
|
@ -88,6 +83,16 @@ void Ball::update_pos(double dt) {
|
|||
_compute_v_z(normal);
|
||||
min_height = fmin(radius, min_height + 0.2 * (radius - min_height));
|
||||
std::cout << "U:" << U << "\n";
|
||||
}
|
||||
|
||||
void Ball::update_pos(double dt) {
|
||||
//double height = (*ground)(Center.x, Center.z);
|
||||
crt_time += dt;
|
||||
if ((bouncing) && (crt_time >= T)) {
|
||||
double old_t = T;
|
||||
double max_t;
|
||||
_compute_parameters();
|
||||
>>>>>>> Utility function
|
||||
max_t = (T - old_t)/2.0 + old_t;
|
||||
|
||||
if (((A + B * max_t - (G_CTE / 2) * max_t * max_t + min_height) < radius)) {
|
||||
|
|
Loading…
Reference in a new issue