Reduce the height of a rubber ball in a cannon over time, so that
it starts closer to the ground when released after the cannon.
This commit is contained in:
parent
490bef516e
commit
bdbc7fd728
@ -151,7 +151,10 @@ void RubberBall::initializeControlPoints(const Vec3 &xyz)
|
|||||||
void RubberBall::setAnimation(AbstractKartAnimation *animation)
|
void RubberBall::setAnimation(AbstractKartAnimation *animation)
|
||||||
{
|
{
|
||||||
if (!animation)
|
if (!animation)
|
||||||
|
{
|
||||||
initializeControlPoints(getXYZ());
|
initializeControlPoints(getXYZ());
|
||||||
|
m_height_timer = 0;
|
||||||
|
}
|
||||||
Flyable::setAnimation(animation);
|
Flyable::setAnimation(animation);
|
||||||
} // setAnimation
|
} // setAnimation
|
||||||
|
|
||||||
|
@ -293,7 +293,15 @@ void CannonAnimation::update(float dt)
|
|||||||
btClamp(m_fraction_of_line, -1.0f, 1.0f);
|
btClamp(m_fraction_of_line, -1.0f, 1.0f);
|
||||||
} // if m_kart
|
} // if m_kart
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// If a rubber ball is in this cannon, reduce its height over
|
||||||
|
// time so that it starts closer to the ground when released
|
||||||
|
float height = m_delta.getY();
|
||||||
|
float radius = m_flyable->getExtend().getY();
|
||||||
|
height = (height - radius) * 0.95f + radius;
|
||||||
|
m_delta.setY(height);
|
||||||
all_heading.setValue(0, 0, 0, 1);
|
all_heading.setValue(0, 0, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// Determine direction orthogonal to the curve for the sideway movement
|
// Determine direction orthogonal to the curve for the sideway movement
|
||||||
// of the kart.
|
// of the kart.
|
||||||
|
Loading…
Reference in New Issue
Block a user