diff --git a/src/items/rubber_ball.cpp b/src/items/rubber_ball.cpp index 6dacda35f..49aa0aafe 100644 --- a/src/items/rubber_ball.cpp +++ b/src/items/rubber_ball.cpp @@ -403,7 +403,14 @@ bool RubberBall::updateAndDelete(float dt) Log::verbose("RubberBall", "newy2 %f gmth %f", height, getTunnelHeight(next_xyz,vertical_offset)); - next_xyz = getHitPoint() + getNormal()*(height); + // Ball squashing: + // =============== + if (height<1.0f*m_extend.getY()) + m_node->setScale(core::vector3df(1.0f, height / m_extend.getY(), 1.0f)); + else + m_node->setScale(core::vector3df(1.0f, 1.0f, 1.0f)); + + next_xyz = getHitPoint() + getNormal()*(height*m_node->getScale().Y); m_previous_xyz = getXYZ(); m_previous_height = (getXYZ() - getHitPoint()).length(); setXYZ(next_xyz); @@ -414,13 +421,6 @@ bool RubberBall::updateAndDelete(float dt) // Determine new distance along track TrackSector::update(next_xyz); - // Ball squashing: - // =============== - if(height<1.5f*m_extend.getY()) - m_node->setScale(core::vector3df(1.0f, height/m_extend.getY(),1.0f)); - else - m_node->setScale(core::vector3df(1.0f, 1.0f, 1.0f)); - return Flyable::updateAndDelete(dt); } // updateAndDelete