void Camera::playSequence() { Q_D(Camera); int curveIndex = MathHelper::toInt(floor(MathHelper::toFloat(d->play_tick) / MathHelper::toFloat(d->play_ticks / d->curves.count()))); int playTicks = d->play_ticks / d->curves.count(); int playTick = d->play_tick - (playTicks * curveIndex); if(curveIndex >= d->curves.count()) stop(); BezierCurve* curve = d->curves.at(curveIndex); ++d->play_tick; float t = 1.0f / playTicks * playTick; setPosition(curve->calculatePoint(t)); setViewCenter(curve->calculateViewCenter(t)); setUpVector(curve->calculateUpVector(t)); if(d->play_tick == d->play_ticks) stop(false); }