Disable smoothing body for network when animation is playing
This commit is contained in:
parent
dba4d05852
commit
c98c20e6a5
@ -51,6 +51,7 @@ AbstractKartAnimation::AbstractKartAnimation(AbstractKart *kart,
|
|||||||
m_check_created_ticks = std::make_shared<int>(-1);
|
m_check_created_ticks = std::make_shared<int>(-1);
|
||||||
m_confirmed_by_network = false;
|
m_confirmed_by_network = false;
|
||||||
m_ignore_undo = false;
|
m_ignore_undo = false;
|
||||||
|
m_has_smoothing_network_body = false;
|
||||||
// Remove previous animation if there is one
|
// Remove previous animation if there is one
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
// Use this code in non-debug mode to avoid a memory leak (and messed
|
// Use this code in non-debug mode to avoid a memory leak (and messed
|
||||||
@ -68,6 +69,11 @@ AbstractKartAnimation::AbstractKartAnimation(AbstractKart *kart,
|
|||||||
// later).
|
// later).
|
||||||
if (kart)
|
if (kart)
|
||||||
{
|
{
|
||||||
|
m_has_smoothing_network_body =
|
||||||
|
dynamic_cast<SmoothNetworkBody*>(kart)->isEnabled();
|
||||||
|
// Disable smoothing network body so it doesn't smooth the animation
|
||||||
|
if (m_has_smoothing_network_body)
|
||||||
|
dynamic_cast<SmoothNetworkBody*>(kart)->setEnable(false);
|
||||||
kart->setKartAnimation(this);
|
kart->setKartAnimation(this);
|
||||||
Physics::getInstance()->removeKart(m_kart);
|
Physics::getInstance()->removeKart(m_kart);
|
||||||
kart->getSkidding()->reset();
|
kart->getSkidding()->reset();
|
||||||
@ -124,6 +130,13 @@ AbstractKartAnimation::~AbstractKartAnimation()
|
|||||||
Physics::getInstance()->addKart(kart);
|
Physics::getInstance()->addKart(kart);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
if (m_has_smoothing_network_body)
|
||||||
|
{
|
||||||
|
dynamic_cast<SmoothNetworkBody*>(m_kart)->setEnable(true);
|
||||||
|
dynamic_cast<SmoothNetworkBody*>(m_kart)->reset();
|
||||||
|
dynamic_cast<SmoothNetworkBody*>(m_kart)
|
||||||
|
->setSmoothedTransform(transform);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // ~AbstractKartAnimation
|
} // ~AbstractKartAnimation
|
||||||
|
|
||||||
|
@ -61,6 +61,8 @@ private:
|
|||||||
|
|
||||||
bool m_ignore_undo;
|
bool m_ignore_undo;
|
||||||
|
|
||||||
|
bool m_has_smoothing_network_body;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** A pointer to the kart which is animated by this class. */
|
/** A pointer to the kart which is animated by this class. */
|
||||||
AbstractKart *m_kart;
|
AbstractKart *m_kart;
|
||||||
|
@ -88,6 +88,8 @@ public:
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
void setEnable(bool val) { m_enabled = val; }
|
void setEnable(bool val) { m_enabled = val; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
bool isEnabled() const { return m_enabled; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
void setSmoothRotation(bool val) { m_smooth_rotation = val; }
|
void setSmoothRotation(bool val) { m_smooth_rotation = val; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
void setAdjustVerticalOffset(bool val) { m_adjust_vertical_offset = val; }
|
void setAdjustVerticalOffset(bool val) { m_adjust_vertical_offset = val; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user