Take ball squashing into account when computing the ball height (so now
the basketball properly touches the ground if its height is 0).
This commit is contained in:
parent
a7debc286a
commit
9166e704e9
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user