From b97088c93363218e8dfb014e2359d323e9ed5bae Mon Sep 17 00:00:00 2001 From: hiker Date: Mon, 9 Oct 2017 10:25:36 +1100 Subject: [PATCH] Fixed computation of new point. The previous approach was based on the newly computed point. If this point should be under the track, and the new height is not enough to offset this, the ball will be tunnelling, which results in the ball being reset to the previous position, i.e. the ball will not move. --- src/items/rubber_ball.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/items/rubber_ball.cpp b/src/items/rubber_ball.cpp index 9e65a76dd..6dacda35f 100644 --- a/src/items/rubber_ball.cpp +++ b/src/items/rubber_ball.cpp @@ -403,7 +403,7 @@ bool RubberBall::updateAndDelete(float dt) Log::verbose("RubberBall", "newy2 %f gmth %f", height, getTunnelHeight(next_xyz,vertical_offset)); - next_xyz = next_xyz + getNormal()*(height); + next_xyz = getHitPoint() + getNormal()*(height); m_previous_xyz = getXYZ(); m_previous_height = (getXYZ() - getHitPoint()).length(); setXYZ(next_xyz);