diff --git a/src/modes/cutscene_world.cpp b/src/modes/cutscene_world.cpp index 12752ebb9..d8be3414a 100644 --- a/src/modes/cutscene_world.cpp +++ b/src/modes/cutscene_world.cpp @@ -187,6 +187,16 @@ void CutsceneWorld::update(float dt) } **/ + if (m_time < 0.0001f) + { + PtrVector& objects = m_track->getTrackObjectManager()->getObjects(); + TrackObject* curr; + for_in(curr, objects) + { + curr->reset(); + } + } + m_time += dt; if (m_time < 2.0f) @@ -204,6 +214,8 @@ void CutsceneWorld::update(float dt) float currFrame = m_time * 25.0f; // We assume 25 FPS + //printf("Estimated current frame : %f\n", currFrame); + const std::vector& subtitles = m_track->getSubtitles(); bool foundSubtitle = false; for (unsigned int n = 0; n < subtitles.size(); n++) diff --git a/src/tracks/track_object.cpp b/src/tracks/track_object.cpp index 6530234fc..16bbbbf65 100644 --- a/src/tracks/track_object.cpp +++ b/src/tracks/track_object.cpp @@ -403,7 +403,12 @@ void TrackObject::reset() a_node->setRotation(m_init_hpr); a_node->setScale(m_init_scale); a_node->setLoopMode(m_is_looped); - + a_node->setCurrentFrame(a_node->getStartFrame()); + + // trick to reset the animation AND also the timer inside it + a_node->OnAnimate(0); + a_node->OnAnimate(0); + if(m_is_looped) { a_node->setFrameLoop(m_frame_start, m_frame_end);