void Elevator::update(Float32 elapsedTime) { if (travelled >= distance) { nextSection(); } position += velocity * elapsedTime; travelled += elapsedTime; }
void Elevator::update(Float32 elapsedTime) { if (controlPoints.size() < 2) { return; } if (remainingWait > 0) { remainingWait = std::max(0.0f, remainingWait - elapsedTime); return; } if (travelled >= distance) { nextSection(); } position += velocity * elapsedTime; travelled += elapsedTime; }
bool Linear::generatePath(){ if(points.size() < 2) return false; visualisation.clear(); visualisation.reserve(100); auto singleStepLengthTmp = singleStepLength; singleStepLength = 0.01; maxSections = points.size()-1; section = -1; step = 0; nextSection(); finished = false; while(!finished){ visualisation.push_back(nextPoint()); } singleStepLength = singleStepLengthTmp; return true; }
void Linear::reset(){ finished = false; section = -1; nextSection(); }