Don't adjust vertical offset for phyiscial objects

This commit is contained in:
Benau 2018-07-13 22:06:13 +08:00
parent 23e5dace40
commit 724828b031
4 changed files with 8 additions and 1 deletions

View File

@ -56,6 +56,7 @@ void KartRewinder::reset()
Rewinder::reset();
SmoothNetworkBody::setEnable(true);
SmoothNetworkBody::setSmoothRotation(true);
SmoothNetworkBody::setAdjustVerticalOffset(true);
} // reset
// ----------------------------------------------------------------------------

View File

@ -159,7 +159,7 @@ void SmoothNetworkBody::updateSmoothedGraphics(
m_smoothed_transform.setOrigin(cur_xyz);
m_smoothed_transform.setRotation(cur_rot);
if (m_smoothing != SS_NONE)
if (m_adjust_vertical_offset && m_smoothing != SS_NONE)
{
Vec3 lc = current_transform.inverse()(cur_xyz);
// Adjust vertical position for up/down-sloping

View File

@ -56,12 +56,15 @@ private:
bool m_smooth_rotation;
bool m_adjust_vertical_offset;
public:
SmoothNetworkBody(bool enable = false)
{
reset();
m_enabled = enable;
m_smooth_rotation = true;
m_adjust_vertical_offset = true;
}
// ------------------------------------------------------------------------
void reset()
@ -79,6 +82,8 @@ public:
// ------------------------------------------------------------------------
void setSmoothRotation(bool val) { m_smooth_rotation = val; }
// ------------------------------------------------------------------------
void setAdjustVerticalOffset(bool val) { m_adjust_vertical_offset = val; }
// ------------------------------------------------------------------------
void prepareSmoothing(const btTransform& current_transform,
const Vec3& current_velocity);
// ------------------------------------------------------------------------

View File

@ -790,6 +790,7 @@ void PhysicalObject::addForRewind()
{
SmoothNetworkBody::setEnable(true);
SmoothNetworkBody::setSmoothRotation(false);
SmoothNetworkBody::setAdjustVerticalOffset(false);
Rewinder::setUniqueIdentity(std::string("P") + StringUtils::toString
(Track::getCurrentTrack()->getPhysicalObjectUID()));
Rewinder::add();