From 2b4d0629117b1760b479aba6c0ec583f5e1e34db Mon Sep 17 00:00:00 2001 From: Benau Date: Fri, 20 Jul 2018 14:09:27 +0800 Subject: [PATCH] Try to fix the remaining ipo issues --- src/animations/animation_base.hpp | 6 +++--- src/animations/three_d_animation.cpp | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/animations/animation_base.hpp b/src/animations/animation_base.hpp index 8de3102b7..a462e3823 100644 --- a/src/animations/animation_base.hpp +++ b/src/animations/animation_base.hpp @@ -47,9 +47,6 @@ private: * one time only (which might get triggered more than once). */ enum AnimTimeType { ATT_CYCLIC, ATT_CYCLIC_ONCE } m_anim_type; - /** The current time used in the IPOs. */ - float m_current_time; - /** The inital position of this object. */ Vec3 m_initial_xyz; @@ -67,6 +64,9 @@ protected: float m_animation_duration; + /** The current time used in the IPOs. */ + float m_current_time; + public: AnimationBase(const XMLNode &node); AnimationBase(Ipo *ipo); diff --git a/src/animations/three_d_animation.cpp b/src/animations/three_d_animation.cpp index 5627d0dc0..a1ab67294 100644 --- a/src/animations/three_d_animation.cpp +++ b/src/animations/three_d_animation.cpp @@ -75,15 +75,13 @@ void ThreeDAnimation::updateWithWorldTicks() Vec3 xyz = m_object->getPosition(); Vec3 scale = m_object->getScale(); - float position = 0.0f; if (!m_is_paused) { int cur_ticks = World::getWorld()->getTicksSinceStart(); - float cur_time = stk_config->ticks2Time(cur_ticks); - position = fmodf(cur_time, m_animation_duration); + m_current_time = stk_config->ticks2Time(cur_ticks); } - AnimationBase::getAt(position, &xyz, &m_hpr, &scale); //updates all IPOs + AnimationBase::getAt(m_current_time, &xyz, &m_hpr, &scale); //updates all IPOs //m_node->setPosition(xyz.toIrrVector()); //m_node->setScale(scale.toIrrVector());