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.
This commit is contained in:
hiker 2017-10-09 10:25:36 +11:00
parent f94b3a9120
commit b97088c933

View File

@ -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);