From 61933b9b7883c8fe953a0f3c55be122b58128959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Oudin?= Date: Mon, 12 Feb 2018 10:48:26 +0100 Subject: [PATCH] A height shouldn't be negative. --- Ball.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ball.cpp b/Ball.cpp index f3f522e..300b2cd 100644 --- a/Ball.cpp +++ b/Ball.cpp @@ -17,7 +17,7 @@ Ball::Ball(Point& _center, double _v_x, double _p, double _q) : } void Ball::_compute_pos(double dt) { - Center.z = A + B * crt_time - (G_CTE / 2) * crt_time * crt_time; + Center.z = fmax(0.0, A + B * crt_time - (G_CTE / 2) * crt_time * crt_time); Center.x += dt * v_x; surface.update_center_pos(Center); }